[zeromq-dev] Address in use error when re-binding socket
Matthias Kluwe
mkluwe at gmail.com
Sun Apr 6 20:54:36 CEST 2014
2014-04-05 15:37 GMT+02:00 Pieter Hintjens <ph at imatix.com>:
> It's not reusing the closed socket, so much as trying to bind to an
> endpoint that's not (yet) free. Depending on the case (especially if
> you have clients still connected), or if you are trying very rapidly
> (as in this case), TCP has not yet freed the endpoint.
>
> In this case I suspect it's because zmq_close is asynchronous and you
> aren't giving the system any time to process that. Hence looping will
> eventually "fix" the issue.
Yes, that's very rapid and might not appear in the wild. I stumbled
upon that while tinkering with some example code.
Asynchronous means that zmq_close does not block and the actual
operations on the OS socket are done by the background thread? Perhaps
this situation is too unusual to be mentioned by the zmq_close man
page.
Regards,
Matthias
More information about the zeromq-dev
mailing list