Detection of socket state over a TCP/IP network

Hi,
I would like to know how to detect the exact network state when using TCP sockets over a TCP/IP network, so as to be able to fire some kind of event after unplugging the ethernet cable and run functions designed to that end in an OP7200 with Dynamic C 9.62.
Is it necessary to have opened the socket in any special way?
Thanks.