[zeromq-dev] default MAX_SOCKETS on Windows set to 63?

Frank Rehberger Frank.Rehberger at web.de
Tue Feb 18 03:15:07 CET 2014


Hi,

On Windows the native function WaitForMultipleObjects  may be used to
wait on multiple sockets concurrently.  This function can deal with at
most 64 objects/sockets/files per thread. If you want to listen on more
sockets concurrently, you have got to cascade some threads for it.  I
dont know the internals of mingw, but that might explain the magic value
of 63 (plus one internal socket probably).

http://tangentsoft.net/wskfaq/advanced.html

To get around this limitation on Windows, one should use the "select"
command implementation (winsock) instead, which is not limited to 64
sockets, but on the other side can not deal with  thread handles,
semaphores and file handles as one could do with the function
WaitForMultipleObjects.

The value of FD_SETSIZE does not affect the upper limit of
|WaitForMultipleObjects()| (|a||lias ||WSAEventSelect()).

Could it be that your application is using |
|WaitForMultipleObjects() or ||WSAEventSelect(). Could you modify your
application to use the "select" command instead?


|//Frank

On 14.02.2014 18:28, Charles Remes wrote:
> I received a bug report from a user who compiled zeromq 4.0.3 on Windows using 32-bit mingw. The code that blew up was:
>
> context = LibZMQ.zmq_ctx_new
> rc = LibZMQ.zmq_ctx_set(context, ZMQ::MAX_SOCKETS, 1023)
>
> At this point, “rc” was returning -1 and the error message is “Invalid Argument”. After playing around with this a bit I discovered that the default MAX_SOCKETS was 63 on this platform.
>
> context = LibZMQ.zmq_ctx_new
> print LibZMQ.zmq_ctx_set(context, ZMQ::MAX_SOCKETS) # => prints “63”
>
> So, trying to set a value above 63 always fails. 
>
> For further confirmation, I ran “make check” and noted that “test_ctx_options” also fails (though it doesn’t tell me why).
>
> Does anyone know why MAX_SOCKETS is set to 63 when compiling on Windows using mingw? When I look at the source, MAX_SOCKETS_DFLT is set to 1023!
>
> cr
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev


-- 
Best regards - Mit freundlichen Grüßen - ????
Frank Rehberger, Berlin, Germany
Phone: +49-173-205-7118
Frank.Rehberger at web.de

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140218/36948b8c/attachment.htm>


More information about the zeromq-dev mailing list