pebbe / zmq4

A Go interface to ZeroMQ version 4
BSD 2-Clause "Simplified" License
1.17k stars 163 forks source link

SetRcvtimeo question #141

Closed iesrbt closed 5 years ago

iesrbt commented 5 years ago

Hi, I'm using sock.SetRcvtimeo like so (before the Connect):

zmqsub, := zmq.NewSocket(zmq.SUB) defer zmq_sub.Close()

a := zmq_sub.SetRcvtimeo(10000) b, c := zmq_sub.GetRcvtimeo() log.Println("=", a, b, c)

The output holds: = nil 0s nil So basically no error nowhere, but timeout still being zero? (Current 0MQ version is: 4 2 3)

And actually: zmq_sub.RecvMessage(0) returns straight away with "resource temporarily unavailable"

What do I miss? Thanks for helping.

pebbe commented 5 years ago

SetRcvtimeo expects a time.Duration. Your literal is interpreted as 0.01 milliseconds, but zmq doesn't handle values below 1 millisecond.

Don't use literal values. Use 5 * time.Second or something like that.

iesrbt commented 5 years ago

Oh... I knew it what me ;-) Thanks for your help.