[zeromq-dev] Any way to flush or clear or manage ports?

Marc Ilgen marc at westofpluto.com
Fri Sep 2 23:18:54 CEST 2011

Hi All
I'm doing some development work with 0MQ - a PUB/SUB application over TCP.
For sake of argument, let's say I'm choosing to connect to tcp:/localhost on
port 5558 in the client and bind to tcp:*:5558 on the server. What I'm
finding as I do development (stopping and starting client and server all the
time) is that after a few debug sessions zmq_bind on tcp:*:5558 will fail.
Sometimes, even if it doesn't fail, the client does not receive server
messages. I'm guessing that all the starting and (improper/incomplete)
stopping of client/server processes results in that port getting somehow
locked up with junk that one process of the other is trying to send or
receive. Of course, to continue debugging I just choose a new port, say
5557, and continue and everything is fine (until that stops working too
after too many starts and stops).

However, if I want to use this commercially, I would like there to be some
way programmatically (say, using some other external 0MQ program) to somehow
flush out/close out port 5558 so that it gets reset to its nice fresh state
and can be used again. Yes I can reboot the computer and that will probably
fix the issue but that is a bit too extreme for a commercial app.

So, is there some code somewhere that I can use to flush/reset a given port
(like 5558) to bring it back to its fresh clean initial state so I can use
it again?


Marc Ilgen
marc at westofpluto.com

More information about the zeromq-dev mailing list