Google Answers Logo
View Question
 
Q: Network Programming in Windows ( No Answer,   2 Comments )
Question  
Subject: Network Programming in Windows
Category: Computers > Programming
Asked by: harryh-ga
List Price: $10.00
Posted: 16 Oct 2002 15:15 PDT
Expires: 15 Nov 2002 14:15 PST
Question ID: 77440
In Windows if you unplug (or plug in) an network cable a bubble will
appear by the taskbar indicating the event.  How does explorer detect
this event, and how can I detect this event in an application of my
own?  Currently I am using WMI, but this is not an optimum solution
because it is a polling method.  I would prefer a system where I
receive a message or a callback or something like that.

Request for Question Clarification by alienintelligence-ga on 19 Oct 2002 03:45 PDT
Hi harryh...

Which Windows? I believe it is handled
differently across the different OS's
platforms.

thanks
-AI

Clarification of Question by harryh-ga on 19 Oct 2002 14:28 PDT
> Which Windows?
Windows XP.

Though if you happen know how it is handled on other versions of
windows, that would be of interest to me as well.
Answer  
There is no answer at this time.

Comments  
Subject: Re: Network Programming in Windows
From: efn-ga on 26 Oct 2002 09:18 PDT
 
I'm not an expert on this, but it looks like you might be able to use
the Transport Device Interface (TDI).  TDI is supposed to generate an
event if "an error occurs in the transport or in an underlying driver
such that network I/O on this local-node address has become unreliable
or impossible," and with the TDI_SET_EVENT_HANDLER IOCTL request, you
can register a function to receive those events.

See:

http://msdn.microsoft.com/library/en-us/network/hh/network/32ioctl_4hde.asp?frame=true
Subject: Re: Network Programming in Windows
From: binkid-ga on 29 Oct 2002 04:35 PST
 
I think you can do it in two ways (but, I haven't tried this): 
First using Windows 2K/XP DDK; NdisMIndicateStatus(...) API with
NDIS_STATUS_MEDIA_DISCONNECT & NDIS_STATUS_MEDIA_CONNECT. When a
network cable is unplugged an interrupt is generated and NIC driver
reorts the change.
See more at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/network/hh/network/103ndisx_5nn6.asp

Second: Using GetIfEntry API declared in Iphlpapi.h. This function
returns a MIB_IFROW structure. Check the dwOperStatus with staus
MIB_IF_OPER_STATUS_DISCONNECTED. See Windows Platdform SDK for this
API.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy