HighTechTalks DotNet Forums  

TCPClient - Detection of remote host disconnection

Dotnet Framework (Remoting) microsoft.public.dotnet.framework.remoting


Discuss TCPClient - Detection of remote host disconnection in the Dotnet Framework (Remoting) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Andrew McNab
 
Posts: n/a

Default TCPClient - Detection of remote host disconnection - 02-20-2007 , 09:46 AM






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
of the TCP connection? Any help would be great thanks )

Reply With Quote
  #2  
Old   
Goran Sliskovic
 
Posts: n/a

Default Re: TCPClient - Detection of remote host disconnection - 02-20-2007 , 10:20 AM







"Andrew McNab" <AndrewMcNab (AT) discussions (DOT) microsoft.com> wrote

Quote:
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.
....

Please check the following threads:
http://groups.google.hr/group/micros...551b31f5320695
http://groups.google.hr/group/micros...b83fa64bc0264e
http://groups.google.hr/group/micros...b157f1ada39904

Regards,
Goran




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.