Monitoring for connection 'change' event...

Mar 9, 2010 at 9:00 PM

I'm looking at possibly using DotRas to extend the Smart Client Software Factory's Network Connection Monitor sub-component...  In that sub-component the interface I need to implement will be looking for me to raise an event when the connection state changes...  So in the case of connected / disconnected I would want to raise said event.

Reference: http://msdn.microsoft.com/en-us/library/cc540751.aspx

Does the DotRas library support any type of eventing model I would be able to utilize? If not, does the core Win32/RAS API support it and the library just needs to address those additional considerations?

Thanks and I look forward to possibly attempting this with your DotRas library - assuming I get the green light to go down the road of dial-up enabling our mobile devices...

Coordinator
Mar 9, 2010 at 9:19 PM

This project is not designed to work on the mobile devices

Mar 10, 2010 at 1:44 PM

We have it good... our mobile device is XP/Vista (Panasonic U1)....  thankfully! So we're good there... no Compact Framework nightmares...

Coordinator
Mar 10, 2010 at 2:18 PM

Thank goodness you're not having to deal with the compact framework!

As for your question, the RasConnectionWatcher does expose events for connect and disconnect but it report when Windows notifies it the connection has disconnected. I have heard reports that it Windows doesn't necessarily immediately recognize the connection has been lost, but when it does report it the RasConnectionWatcher component will raise the appropriate event. You can monitor for a specific connection if you provide the handle to the watcher before you have it begin monitoring, or you can receive notifications from every connection on the machine. Keep in mind that whenever a connection is dialed, RAS issues it a new handle.