TCP problems

Pierre A. Humblet
Mon Jul 29 14:48:00 GMT 2002

Conrad Scott wrote:

> It does seem to be something to do with TIME_WAIT and linger but
> I'm unclear exactly what.  Do any of the following sound familiar?
> *) The original problem (with a clean copy of CVS head, compiled
> either w/ or w/o debugging enabled) was that the server would
> accept a certain number of successive connections then refuse to
> accept any more until it was restarted.  Waiting a substantial
> amount of time didn't clear the problem up, only re-starting the
> server worked, so I don't see how it's a TIME_WAIT problem.

Or once it overflows some limits it gets into a screwed up state
and stays there.

> *) I just hacked the linger setting out of fhandler_socket::close
> and now the server seems to accept an unbounded number of
> successive connections.  I just tried 10000, which is more than
> twice the number of temporary ports, w/o any problem.

But I would bet that won't help Nicholas' ME. He will need to set
linger ON and timeout to 0 (or possibly some small positive). 
> I'll try some more combinations, but interestingly I can't
> recreate this with my direct winsock2 server: linger or not it
> runs forever too.  I'll try some more combinations.

Weird. Cygwin also makes direct Windows calls. There must be
a slight difference.

> Another strangeness I'm getting is that if I run netstat -a on my
> win98/SE box, it never shows more than 10 connections (e.g. one
> LISTENING and nine, the most recent nine port numbers, in
> TIME_WAIT).  This is regardless of the other changes I've
> described.  There must be more ports in TIME_WAIT than that
> (especially with the linger setting in cygwin) so what's up?  Is
> netstat known to be dodgy on win98?

Not that I know of.
Note that netstat is showing you connections, not sockets in use. 
They are different. E.g. with shutdown () the connections are gone 
but you can get WSAENOBUFS, indicating the sockets are still using


More information about the Cygwin-developers mailing list