Quote Originally Posted by ball
You can send heart beat socket signal periodically, to check if any side is disconnected.
But it won't tell you the cause of connection failure. Someone might have pulled the plug somewhere along the route. The abstraction of "connect state" (in regard to Transport Control Protocol) doesn't allow any notification whatsoever. The "connection" is purely virtual.

The only possibility I see to obtain information about a network interface being turned off is to use a platform specific API for querying the operating system about it. Of course it would only work on the host that dropped the interface and not on its peer.