PDA

View Full Version : Getting informed about newly connected network adapters



RThaden
18th January 2010, 14:41
Hi all,

I have an app which at startup looks for available network adapters, creates a UDP socket for each one and sends UDP identification broadcasts to all found nets to scan for certain devices.
All works fine, except when a new adapter is available (e.g. someone plugs in the network cable) the list is not updated.
Of course, I can retrieve the new adapter list all 10 seconds using a timer and refresh the UDP sockets but it would be more elegant to have interrupt instead of poling and being notified of a new adapter.
Is there such a thing as a signal which informs about new or removed adapters?

At least, I didn't find it.

Best regards,

Rainer

wysota
19th January 2010, 09:25
No, Qt has no facilities for that. You need to intercept a native event using QApplication::winEventFilter() or QWidget::winEvent() and handle it there.

RThaden
19th January 2010, 15:51
Thanks Wysota. After some reading and searching I found an article about catching WMI events.
For anyone who is interested (Win32 specific):
http://www.codeproject.com/KB/system/UsingWMI.aspx

Best regards,

Rainer