"Vijay" <vi**********@yahoo.com> wrote in message
news:a6**************************@posting.google.c om...
Hi all,
i have TCP client server application written in C# using async
socket methods, eg BeginReceive(), BeginEnd() etc
server is continuesly running in the background, client connect to
server and recives data from server.
If server application shuts down client immedeatly recieves
disconnection or exception, but im not able to detect if some body
removed network cable of node , where server is running.
Client continuesly waits for data from server
Also netstat command shows the client in ESTABLISED state.
How to handle this situation.
================================================
The following may or may not suit your needs -
From "Media Sense" (W2K+) topic on MSDN:
"Media sense support allows the protocol stack to react to events and remove
stale parameters. For example, if a Windows 2000 computer is unplugged from
the network (assuming the network adapter supports Media Sense), after a
damping period of 20 seconds, TCP/IP invalidates the parameters associated
with the network that has been disconnected. The IP address(es) no longer
allow sends, and any routes associated with the interface are invalidated.
If an application is bound to a socket that is using an address that is
invalidated, it should handle the event and recover in a graceful way, such
as attempting to use another IP address on the system or notifying the user
of the disconnect."
See also MSDN topics RestoreMediaSense and DisableMediaSense.
--
Regards,
Jim Allison
jw*********@digitalcollimation.com
(de-mung by removing '.1')