How to monitor network status in Real-time

Hi All,

I want to monitor the network status in program,such as:
If there is “A network cable is unpluged” in “Local Area Connection”,
I want to capture it in program in Real-time,how can I realize it?

Someone said the function InternetGetConnectedState can do,
but I checked this function,found that when the system didn’t access the internet
for a time though the network is OK,this function also returns FALSE just like
the network is not OK.

Someone said call the function WSAIoctl(),but this function has too many parameters,
and I can not deal it easily.
If I want to use this function,how to designate the parameters?

Any help is appreciated.Thanks.

Best Regards
Zhou ChengJun

> I want to monitor the network status in program,such as:

If there is “A network cable is unpluged” in “Local Area Connection”,

  1. IOCTL_NDIS_QUERY_GLOBAL_STATUS for OID_GEN_MEDIA_CONNECT_STATUS
    OR
  2. WMI


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com