Hi Edward, Seeing as you raised this issue, and I have been experiencing the same thing, I thought I'd dedicate the day to trying to understand what is happening, and the good news is that I've managed to solve my problems, and gained a valuable understanding of the problem. Here's the thing. As a developer, you always suspect your code first don't you. Well, in my case, and maybe in yours, it's not the code.
I did several tests on two Windows 2003 servers (2xQuad core, 4GB RAM, Win2003 Std Server) (one as a client and one as a server) and a Linux Server as a client, and the results were totally unexpected. I managed to get the same thing to happen, (server stopped listening), but here's the thing, it didn't really stop listening ... I could still connect a socket to the port via telnet from the Linux server, but not from the windows server. So that got me goggling ... Windows has some interesting registry settings which limit the number of OUTBOUND connections. Yip ... the outbound socket from my stress testing app was the problem, not the listening socket in the server application. Of course your server application may also have outbound sockets, as mine does, and that would simply exaggerate the problem. Anyway, this is best described in http://www.redbooks.ibm.com/redpapers/pdfs/redp3943.pdf Just look at the section under TCP TIME-WAIT Delay. Basically it says that the default Windows 2003 Server install limits the number of outbound sockets to 5000, and the TIME-WAIT to 120 seconds (That means that after a disconnect, Windows does not reuse that socket number for 120 seconds). Now, in my case I was exceeding this, and you may well be too. The good news is that you can crank these numbers up quite a bit. The number of sockets can go up to 65534, and the TIME-WAIT can come down to a few seconds if you wish with a recommendation of 30 seconds. Anyway, I'm glad that this is resolved from my perspective anyway. I hope that it works for you. Remember that you have to reboot the server before the changes will take effect. Cheers Erich -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Edward Koo Sent: Thursday, 13 September 2007 3:33 p.m. To: twsocket@elists.org; [EMAIL PROTECTED] Subject: [twsocket] TWSocket Stop Listening After Certain Numbers ofConnected Clients. Hi Wilfried, thank you for replying. How do i check how much non pageable ram is available? The test i did for Windows Server 2003 runs on a system with Xeon processor and 3gb ram. It consistently stop at 180-200 concurrent clients which is very strange compared to the other test that accepts 500-600 concurrent clients on Windows XP with single core processor and only 512mb ram. The difference i notice on the Windows Server 2003 test were that the data being received is a lot faster which makes me suspect that the main thread that listen to clients are too busy pushing data to clients and after a while the listening were timed out or something like that? Btw, after i diconnect all client i have check with netstat -n -p tcp a few times and there's no socket in WAIT_STATE at port 20000 which is the port the server use and still the problem persist. It just won't accept client anymore even Netstat -a shows the server in listening state. See the following, C:\Documents and Settings\edwardkoo>netstat -a Active Connections Proto Local Address Foreign Address State TCP Edward:http Edward.N2NMSC.COM:0 LISTENING TCP Edward:epmap Edward.N2NMSC.COM:0 LISTENING TCP Edward:microsoft-ds Edward.N2NMSC.COM:0 LISTENING TCP Edward:gds_db Edward.N2NMSC.COM:0 LISTENING TCP Edward:3389 Edward.N2NMSC.COM:0 LISTENING TCP Edward:20000 Edward.N2NMSC.COM:0 LISTENING TCP Edward:58581 Edward.N2NMSC.COM:0 LISTENING TCP Edward:1059 Edward.N2NMSC.COM:0 LISTENING C:\Documents and Settings\edwardkoo>netstat -n -p tcp Active Connections Proto Local Address Foreign Address State TCP 127.0.0.1:1089 127.0.0.1:1090 ESTABLISHED TCP 127.0.0.1:1090 127.0.0.1:1089 ESTABLISHED TCP 127.0.0.1:1091 127.0.0.1:1092 ESTABLISHED TCP 127.0.0.1:1092 127.0.0.1:1091 ESTABLISHED TCP 127.0.0.1:1276 127.0.0.1:9000 ESTABLISHED TCP 127.0.0.1:9000 127.0.0.1:1276 ESTABLISHED TCP 192.168.0.136:1106 202.75.55.43:2888 ESTABLISHED TCP 192.168.0.136:1275 192.168.0.136:3050 ESTABLISHED TCP 192.168.0.136:1304 192.168.0.11:135 TIME_WAIT TCP 192.168.0.136:1305 192.168.0.11:1026 TIME_WAIT TCP 192.168.0.136:3050 192.168.0.136:1275 ESTABLISHED I made a button that will close the listening socket and re-listen so when the problem occurs i click the button to test. After i click the button the listening will work for a while and then it will eventually stop again. I already tried catching OnBgException but it does not trigger even though the problem occurs. ____________________________________________________________________________ ________ Be a better Heartthrob. Get better relationship answers from someone who knows. Yahoo! Answers - Check it out. http://answers.yahoo.com/dir/?link=list&sid=396545433 -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be