[zeromq-dev] ZMQ occupies random TCP ports on Windows

Chuck Remes cremes.devlist at mac.com
Tue Sep 27 18:43:55 CEST 2011

On Sep 27, 2011, at 11:20 AM, Michał Sznajder wrote:

> On Tue, Sep 27, 2011 at 6:01 PM, Chuck Remes <cremes.devlist at mac.com> wrote:
>> On Sep 27, 2011, at 10:51 AM, Michał Sznajder wrote:
>>> I have an application on Windows that is run in multiple instances on
>>> many boxes. Instances may come an go in random order. Instances use
>>> predefined "connection strings" to zmq_bind(). Both tcp:// and
>>> inproc:// are in use.
>>> Unfortunately ZMQ opens arbitrary TCP ports on Windows in order to
>>> simulate socketpair(3) functionality [1] that is used by some kind of
>>> signalling mechanism(?). As a result sometimes application port gets
>>> occupied by another instance and my application fails to start.
>>> Any idea how to workaround it? There was once discussion about this in
>>> another context [2] but finished without any code changes...
>> The only workaround is to change your transport from ipc to tcp and pick some specific ports to use. A permanent fix is awaiting "real" ipc support on Windows. There are a few people poking at this but there haven't been any code drops from them in months that address this issue.
> I was thinking of this, eg. convert all my inproc into tcp. But even
> something as simple as
>    ZMQ.Context ctx = new ZMQ.Context(1);
> creates 4 TCP connections... Without even getting any socket or bind...
> I checked clrzmq2 C# bindings and they do not spawn those connections.

Wait, now you are talking about inproc transport. That does *not* use any tcp connections. It merely flips pointers around between sockets.


More information about the zeromq-dev mailing list