| Dart Home | PowerTCP Sockets for .NET | Custom Development | Reply | PowerTCP Sockets for .NET (Secure and Standard) Topics | Forums |
| Author | Forum: PowerTCP Sockets for .NET (Secure and Standard) Topic: Managing Number of Connections |
| cambler From: Redmond, WA USA Posts: 102 Member Since: 04/14/03 |
posted November 21, 2003 7:57 PM I have a simple application that creates a server object and listens on a port. When a connection is made it reads in a string, sends out some data, and calls e.Tcp.Close() before existing. This is all done in the tcpServer_Connection() method. I am 100% certain that I'm calling Close in all cases. I've created a perfcounter that tracks myServer.Connections.Count to see how many connections are active. This number starts at zero (of course) and goes up and down as clients connect and disconnect, but the number tends to go up over time, gaining about 1 every minute or so, until I have more connections open than available worker threads (I override the 25-thread limit to 100) at which time the server becomes unresponsive. Any clue as to why a connection wouldn't be released when I call e.Tcp.Close? Is there anything I can do on a periodic basis to examine these connections and forcably kill them to regain some available connection room? |
| cambler From: Redmond, WA USA Posts: 102 Member Since: 04/14/03 |
posted November 24, 2003 1:06 PM See, here's what I'm not getting. I dump the ArrayList of connections to see how many are connected and for how long. Note that this one (IP address redacted for privacy) has been active for over 5 minutes! But I read input, send output, and then CLOSE! Oh... wait... is it possible that my read call isn't timing out?! I want to read in a string until a CRLF, so I use: e.Tcp.Stream.Read("\r\n", 128, ref found); Might that not time out, and might the connection just be sitting there, waiting? === connection dump === Time Now: 10:03:29 AM Connection 1: Connected to xxx.xxx.xxx.xxx:4831 9:57:46 AM |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted November 24, 2003 1:16 PM That's possible. What do you have RecvTimeout set to? |
| cambler From: Redmond, WA USA Posts: 102 Member Since: 04/14/03 |
posted November 24, 2003 1:17 PM Default. I didn't set it. |
| cambler From: Redmond, WA USA Posts: 102 Member Since: 04/14/03 |
posted November 24, 2003 1:18 PM I presume I want to set it in the connection event handler before I call read on the stream? The timeout affects stream reading as well as the tcp.read higher-level call, yes? |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted November 24, 2003 1:28 PM Yes, that's correct. |
| cambler From: Redmond, WA USA Posts: 102 Member Since: 04/14/03 |
posted November 24, 2003 1:57 PM Yup. That was it. That'll teach me to trust defaults :-) |
| Reply | PowerTCP Sockets for .NET (Secure and Standard) Topics | Forums |
This site is powered by
PowerTCP WebServer for ActiveX
|