This project is read-only.

Dormant: Server unavaiable

Sep 19, 2011 at 5:14 PM

Hi again,

Any tips perhaps on how I can clear an ikeV2 vpn connection that is in a "Dormant" state?  To recreate this state, I dial a for example a 3g connection manually. Then dial my ikev2 vpn via code. Then , I manually kill the 3g connection. ->

I can check for it in the Dialer's statechanged event:

 --

 RasConnection connection = RasConnection.GetActiveConnectionByName(this.buddyDialer.EntryName.ToString(), this.rasBuddyPhoneBook.Path);

 if (connection.GetConnectionStatus().ConnectionSubState == RasConnectionSubState

.Dormant)

{

     // How can I clear the status ? if I hang-up - my app just waits...

}

 

 



Sep 24, 2011 at 6:04 AM

If you're trying to safely handle a connection that has been disconnected while a connection attempt is underway, you would need to handle that in the StateChanged or DialCompleted events. Since the StateChanged event is raised from a callback within Windows, you may just be causing a blocking issue in RAS accidentally. Have you tried checking for errors in the DialCompleted event and handling it there? If you're trying to handle a connection that has been disconnected after a connection attempt has been completed, you'll need to use the RasConnectionWatcher component to receive an event when the connection is disconnected. The component itself doesn't know or poll the connections on the machine, Windows tells it when it notices that the connection is now disconnected so it may take a little while before the event is raised.

You may need to use the DialAsyncCancel method on the RasDialer class if the connection attempt is still in progress. Depending on where the connection is at in the connection process, GetActiveConnections may or may not return it. You may just have to wait until Windows releases the connection. There's a good likelyhood that it's just trying to send packets over a closed connection and hasn't noticed it yet.

Sep 28, 2011 at 4:07 PM

Thx Jeff! The RasConnectionWatcher did the trick for me.