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

Christian Martinez chmar at microsoft.com
Wed Sep 28 18:25:38 CEST 2011

Would studying this help at all? https://github.com/joyent/libuv/tree/master/src/win


-----Original Message-----
From: zeromq-dev-bounces at lists.zeromq.org [mailto:zeromq-dev-bounces at lists.zeromq.org] On Behalf Of Martin Sustrik
Sent: Wednesday, September 28, 2011 9:00 AM
To: ZeroMQ development list
Cc: Brad LaFountain
Subject: Re: [zeromq-dev] ZMQ occupies random TCP ports on Windows

On 09/28/2011 05:49 PM, Brad LaFountain wrote:

>   When i was looking into this problem, there is some good discussions 
> about IOCP and 0mq almost seems like it would have been nice to have 
> this on a wiki somewhere, because the topic keeps coming up and it 
> took me awhile to find all of the posts.

The summary is pretty simple: It would be nice to have an IOCP polling mechanism supported the same way as select, poll, epoll, devpoll and kqueue are.

The fact that nobody was able to implement it so far indicates that it's actually not that easy.

>   I don't know the internals of 0mq very well, but from what i could 
> tell (at the time) the thing that needed to be done is get the IOCP 
> events and then push them to an inproc queue to be polled with the the 
> normal way 0mq does, but i'm learning from some recent messages that 
> inproc does some funny stuff with ports as well.

That's just a side effect of the silly way Windows APIs are designed. 
There's no socketpair() function so we have to simulate in-process pipe using a TCP connection. We can't use NamedPipes because the HANDLEs can't be polled on using select().

zeromq-dev mailing list
zeromq-dev at lists.zeromq.org

More information about the zeromq-dev mailing list