all groups > dotnet remoting > february 2007 >
You're in the

dotnet remoting

group:

TCPClient - Detection of remote host disconnection


TCPClient - Detection of remote host disconnection Andrew McNab
2/20/2007 6:46:15 AM
dotnet remoting:
Before I go and make massive changes to a TCP/IP library I made, I was
wondering if the detection of connection loss is possible through the
TCPClient class.

The problem I have is that I make a connection to another application using
a TCPClient in one app and a Listener with Client in the other app. I close
the app with the listener. I then try to send data to the listener app.
TCPClient.Connected returns true after the remote connection is forcefully
closed. I understand that the value of TCPClient.Connect is based on the
success of the previous send/recieve action. When I perform a send operation,
there is no exception thrown. Trying to perform a send operation a second
time throws a socket exception stating the connection was closed at the
remote end.

I was hoping that the exception would be thrown on the first send operation
after the connection was closed. Any way around this or will I have to send
test bytes at the start of each send operation in order to test the integrity
Re: TCPClient - Detection of remote host disconnection Goran Sliskovic
2/20/2007 4:20:40 PM

[quoted text, click to view]
....

Please check the following threads:
http://groups.google.hr/group/microsoft.public.dotnet.languages.csharp/browse_thread/thread/ae3b549026aab536/6e551b31f5320695
http://groups.google.hr/group/microsoft.public.dotnet.languages.csharp/browse_thread/thread/636ead950a4b47b5/aeb83fa64bc0264e
http://groups.google.hr/group/microsoft.public.dotnet.framework/browse_thread/thread/796ea6dc1d5fae90/18b157f1ada39904

Regards,
Goran

AddThis Social Bookmark Button