This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: pthreads and sockets - Cannot register window class error


> I can't replicate your problem, but I know where it is coming from,
> basically standard windows winsock is not geared up to handle that man
> socket connections. When a socket is made and then closed the socket
> actually stays open for about 240-300 seconds depending on your
> registry settings, this is so that winsock can make sure the
> connection has been properly closed off.

As Dave wrote - normal TCP behaviour.

> what you are seeing is that basically as you run your program more and
> more times, you are creating sockets in memory, every time the socket
> is closed YOU think that the socket is cleaned up but its not, and so
> you basically loose a bit of memory until the timeout for the socket
> has occurred, i guess through debugging where you run and re-run your
> test app you have run out of RAM so you see these errors.

- Program failed with second run after reboot - netstat showed 140
sockets in TIME_WAIT state.
- Program did run succesfully some tries later when netstat showed 484
sockets in TIME_WAIT state.

> The only thing you can do is not make so many client socket connections

Same error did happen with 20 connections. I would not describe it as

> or use windows server which has a winsock geared for server like behavior,
> or make the modifications mentioned in the article, or just simply use *bsd
> or linux tcp/ip stack.

Sure I can use other stack.  But I prefer to find out exactly where and
why error happens, so I can avoid it in the future.

Best regards,

Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]