A quick question about socket.

I've got an network application that works fine under normal circumstances and Im now trying to add a bit of error checking.

The procedure for starting up the network connection:
(using udp) :
Code:
if( !AfxSocketInit() )
  return ERROR;

if (ASyncSocket::Create(port, SOCK_DGRAM, FD_READ) == 0)
  return ERROR;
and then it's ready to use both sendto and OnReceive methods.

If I then disable the network devices (in control panel->system->device manager) and unplug the network cable from my laptop the program still works fine. How is it possible to check if the network device is enabled\working?

Appreciate any response.