Very slow to connect

Nov 27, 2010 at 7:13 PM

I have used the sample code to make a VPN connection from a VB.NET program using v1.2

I am connecting to my office network. 

Using a predefined (defined in Windows Network Settings) VPN connection I get connected to the office in 2 to 3 seconds from my home connection (High Speed Cable Connection). When I use my code it takes 60+ seconds to hit the connected event. 

I have tried to .DIAL and .DIALASYNC.  Dial never seems to connect but Dialasync fires the connect event in 60+ seconds. 

My code does nothing, after dialasync, that is outside the connected event handler so there should be no code imposed delays.  Using a webpage such as shows what gateway I am on.  I seem to actually be connected to the office gateway quite quickly but I don't hit the connected event handler for quite some time.  Any suggestions what I might need to do or what I might be doing wrong?


Nov 28, 2010 at 2:27 AM
Edited Nov 28, 2010 at 2:27 AM

The Dial method is a synchronous call, and as such does not raise any events on the component. If it connects, it simply returns from the method without throwing any exceptions. If you want to receive information during the connection process, you need to use DialAsync.

As for the delay issues, I do not know. There are no delays built into the code (outside of HangUp which is a requirement), so I do not know what could be causing the issue on your machine. Once the RasDial API reports the state changes, it immediately raises the StateChanged event on the component. Once it receives a Connected notice, it raises the DialCompleted event and reports a successful connection attempt.

Nov 29, 2010 at 1:32 PM

Thanks for the info.  I tried the same code on another machine at home and I got connected fairly quickly.  The machine that connects slowly is running WIndows Server 2003.  Not sure that would make any difference but the problem was on that machine only it would seem.

Nov 29, 2010 at 8:29 PM

You can try making an app that does an asynchronous call and use the state changed event to monitor when during the connection process it starts to hang, Perhaps that will give you some indication where the problem lies. If it's happening before the connection is dialed once you call Dial, the issue is with my code (possibly when testing for EAP data). If it starts hanging during the connection attempt, that's more than likely a problem with your code. However, it could also be something in Windows during the authentication process that's taking longer than normal. Or perhaps the code will run just fine, in which case it's definitely with your app.

Hope that helps!