This project is read-only.

Synchronize RasConnectionWatcher and RasEntry.Options.ReconnectIfDropped

Apr 24, 2013 at 9:49 AM
Edited Apr 24, 2013 at 10:21 AM

I want to keep permanent internet connection and redial if connection is dropped. So when RasConnectionWatcher.Disconnected event occurs I want to redial. But how will this correlate to the connection setting RasEntry.Options.ReconnectIfDropped = true. Will theese two conflict or what? How will the modem be rediled by two means at the same time?
Apr 25, 2013 at 3:51 AM
It really depends on whether you want to control it, or have Windows handle it for you. It would result in a race condition most likely between which mechanism attempts the redial. If the disconnected event gets raised and it wins, the reconnect if dropped option would most likely not do anything. If however the disconnected event gets raised after the reconnect if dropped mechanism, you'd most likely end up getting a device already in use or some other error thrown.

I haven't tested against that scenario to be honest, would be worthwhile checking yourself. In the end it's all about control, and whether you'd like to do it or have Windows do it for you.

If you're going to have Windows do it, you might want to ensure the RedialCount and RedialPause properties on the entry are set to what you want them to be.
Apr 25, 2013 at 8:06 AM
Edited Apr 25, 2013 at 8:23 AM
Thank you for reply!
I can not fully test it because the only thing I can do is to disconnect the connection manually in the windows interface. I can only imagine what other kinds of disconnections may happen by the provider and how windows will behave in such situation. So I believe it is more reliable to control everything in the RasConnectionWatcher.Disconnected event handler. Also am going to redial if connection is OK but the target resource is not pinging so I will handle everything at one place and will not use ReconnectIfDropped by Windows at all.
Apr 27, 2013 at 2:38 AM
You could do what I had to do previously when people had disconnection issues with Linux VPN servers, use VirtualBox ( to setup a server running on your machine and connect to it. Of course you'll need to know how to configure a RAS server, but there's a pretty decent amount of information floating around the Internet. Testing those sorts of situations can be somewhat complicated without having a RAS server you can control while doing integration testing.