Wait for Connection

Sep 11, 2009 at 9:11 AM


First may I thank you for DotRas.

I am using the RasDialer in my solution, however is it possible to monitor the connection process?

I want my coode to wait to find out wether the connection was successful before moving on to the next part of my code that maps drives to the remote machine.



Sep 11, 2009 at 1:43 PM

It sure is, the Dial method is a synchronous call and will throw a RasException if the connection attempt fails for any reason. If you would rather dial the connection asynchronously, you can use the DialAsync method and use the DialCompleted event to check whether the connection was successful via the Connected property on the DialCompletedEventArgs class.

Depending on whether you have a UI or if it's based on a command line / windows service app will usually determine which dialing method you decide to utilize.