TCP client looses connection. How to debug?
Posted on 2005-04-13
I connect to a TCP Listener through
and then do this on every iteration of a loop
Dim networkStream As NetworkStream = tcpClient.GetStream()
I then do:
If networkStream.DataAvailable() Then
--do something and write back to listener
The listender will periodically send information to this client. Probably every 10 - 30 minutes at most. After a while, the above conditional is never ran. Meaning, the code inside the IF isn't executed. This only happens on one particular machine. I've tried it on three machines. All are behind firewalls and routers. I can't figure out why the one machine seems to just die on the connection. Another client on a different machine still gets info from the listener so I know the listener is still active. I have the client open in VS.NET debugger and see the while loop is still going so the app itself hasn't died.
How do I make sure the client is still connected? Also, in general, how can I debug this to figure out the problem?