Search All Forums
Dart Home | PowerTCP Sockets for .NET | Custom Development Reply | PowerTCP Sockets for .NET (Secure and Standard) Topics | Forums   
AuthorForum: PowerTCP Sockets for .NET (Secure and Standard)
Topic: Dropped TCP Connection - StateChanged event not fired

From: London, United Kingdom
Posts: 12
Member Since: 10/15/12
posted January 10, 2013 5:26 AM

I have a TCP client and server communicating correctly. The client and server fire the StateChanged event when either closes the TCP connection as expected. However, I need to handle scenarios when the connection is dropped without the TCP connection being closed gracefully, for example if the network cable is unplugged. In this situation the StateChanged event does not fire. Could you advise on the best approach to handle this scenario, should I be constantly polling client and server to check that the connection is still alive or is there another way to check for connections that are dead?
Nick B (Admin)

From: Utica, NY USA
Posts: 593
Member Since: 05/25/10

Extra Support Options
Custom Application Development

posted January 10, 2013 10:56 AM


A pending read or write is required to detect a changed network status, and setting Tcp.SocketOption.KeepAliveTime to a lower value will start sending keepalives sooner (which is useful for detecting circumstances such as when the cable is pulled; read won't immediately throw an exception in that scenario).
Reply | PowerTCP Sockets for .NET (Secure and Standard) Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX