More than 64 sockets ?

Ross Smith ross.s@ihug.co.nz
Mon Dec 6 14:28:00 GMT 1999


Chris Faylor wrote:
> 
> On Mon, Dec 06, 1999 at 04:17:28PM -0500, Chris Faylor wrote:
> >On Mon, Dec 06, 1999 at 09:54:39AM -0600, Mumit Khan wrote:
> >>stefan <stefan@linux.f1.fhtw-berlin.de> writes:
> >>> Hello,
> >>>
> >>> we were porting a server software to Win9x/NT and had to notice that you
> >>> cannot accept() more than 64 sockets. Why is this ? Can anyone help us ?
> >>
> >>The underlying OS API, WaitForMultipleObjects, has a limit of 64 handles
> >>it can wait on, and that's probably the reason. There are tricks to get
> >>around it, but it requires creating multiple threads. Not pretty.
> >
> >This isn't a problem with cygwin.  Cygwin uses the Winsock select() for
> >sockets.  There probably is a limit there but it's not 64.
> 
> Just to clarify:  The "This" above refers to the WaitForMultipleObjects
> limit of 64 handles.  This particular hard limit probably does not affect
> cygwin.
> 
> There is a hard-coded limit in winsock.h which is probably what is coming
> to play here.

This section from the Winsock Programming FAQ may be relevant:

> 3.17 - Can I change FD_SETSIZE to make select() wait on more than 64
> sockets?
>
> You can, but in practice it may not work. Several common Winsock
> stacks and Layered Service Providers limit themselves internally to
> the default value of FD_SETSIZE, 64. However, you can write a test
> program to try this on the systems you plan on supporting, to see if
> they are not limited. Also, you can always send each group of 64
> sockets to a different thread, so that several calls to select() can
> occur simultaneously.

( http://www.cyberport.com/~tangent/programming/winsock/ )

--
Ross Smith <ross.s@ihug.co.nz> The Internet Group, Auckland, New Zealand
========================================================================
    "Be careful about using the following code -- I've only proven
    that it works, I haven't tested it."           -- Donald Knuth

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com



More information about the Cygwin mailing list