Sockets closing

Hi,

I have a strange problem with a TCP socket server. It seems like either client or server socket become unreachable after a while although neither side is closing the socket (at least not on purpose). The connection to the server is fine because when I have a separate ping process running, no packets are dropped. However, after while, when I send a message to the server it simply doesn't get there. Any idea what might cause this and what the best way is to ensure connectivity

Thanks,

Tom


Answer this question

Sockets closing

  • Caleb Vetter

    The best thing to do is to monitor the network traffic on both sides (client and server). You first need to verify that the traffic being sent is getting from client to server. If it is not, then the packet is being dropped somewhere in an intermediate device in your network. If it is, then System.Net tracing will help you to determine the sequence of calls occurring on each machine. You will then be able to determine if you close down a listening socket inadvertently. Stepping through in the VS debugger would also be a good tool if the data is getting through the network. For information on using a network monitor and system.net tracing, please see http://blogs.msdn.com/dgorti



  • René Poppe

    I introduced a "ping" method that sends a couple bytes to the server every 10 seconds and haven't experienced that problem ever since...

  • Sockets closing