verify VPN connection?

S

swyck

I have an app that I need to run when users log on. However we have a
number of home users that often connect via VPN. There is no point in
running the application until the user is connected to our network.
Any thoughts as to the best way to do this?

My intial idea is that I'd start a loop. Verify connectivity to our
network using:

My.Computer.Network.Ping("servername")

That should work for both VPN and internal users. If that returns
false then the app sleeps for a few minutes, wakes and checks the
connection again. I thought I'd sleep using:

System.Threading.Thread.Sleep(300000) '5 minutes

I don't want to be pinging all day either so I thought that I'd only
try 4 or 5 times and if the connection is never established then just
close the application. If the connection is available I'd break the
loop and complete processing.

Any issues with this? Any suggestions? Thanks for any help
 
J

Jason Newell

Retrying every so often is fine but I would not recommend Ping in
general. Often times server admins will disable ping response from the
server due to modern virus\attacks so Ping will yield unreliable
results. I would rather execute your Connect() method or whatever it is
you use to connect to the server and handle any results\exceptions.

Jason Newell
Software Engineer
www.jasonnewell.net
 
C

Clive Lumb

I would rather execute your Connect() method or whatever it is you use to
connect to the server and handle any results\exceptions.

I would even go so far as suggesting that you connect to the port that is
used by the app or the vpn, that way you really know if you are connected
(e.g. if the remote users ISP isn't blocking that port)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top