Home All Groups Group Topic Archive Search About

VB.net 2003/2005- Can't figure out how to test for working internet connection

Author
12 Oct 2006 1:58 PM
adalton
I've been trying to figure out how to test for a valid internet connection.
I am able to connect to a valid internet connection, but when it drops, or
if it is not there when my program starts, I get an exception.

This probably is a newbie question, but I do not even know what or how I
would trap that error.

Author
12 Oct 2006 7:29 PM
Stacey
Look into Ping
http://msdn2.microsoft.com/en-us/library/system.net.networkinformation.ping(VS.80).aspx

just ping a known ip address and see if it is reachable.
Show quoteHide quote
"adalton" <adal***@newsdalton.com> wrote in message
news:eglhmi02dj3@news1.newsguy.com...
> I've been trying to figure out how to test for a valid internet
> connection.
> I am able to connect to a valid internet connection, but when it drops, or
> if it is not there when my program starts, I get an exception.
>
> This probably is a newbie question, but I do not even know what or how I
> would trap that error.
Author
14 Oct 2006 9:05 AM
Michel Posseth [MCP]
And what if the user is behind a Proxy  ??  :-)

in most company`s people are behind a connectbox , or proxy so ping is only
possible to the local network

i would go for another aproach i  would just request a small test page on my
own server , even better you could also implement a so called heartbeat
a background thread just request a page every few seconds this way you can
even detect problems on the network to your server during transfers

regards

Michel Posseth [MCP]


Show quoteHide quote
"Stacey" <StaceyL@community.nospam> schreef in bericht
news:eoUWKTj7GHA.3280@TK2MSFTNGP02.phx.gbl...
> Look into Ping
> http://msdn2.microsoft.com/en-us/library/system.net.networkinformation.ping(VS.80).aspx
>
> just ping a known ip address and see if it is reachable.
> "adalton" <adal***@newsdalton.com> wrote in message
> news:eglhmi02dj3@news1.newsguy.com...
>> I've been trying to figure out how to test for a valid internet
>> connection.
>> I am able to connect to a valid internet connection, but when it drops,
>> or
>> if it is not there when my program starts, I get an exception.
>>
>> This probably is a newbie question, but I do not even know what or how I
>> would trap that error.
>
>
Author
13 Oct 2006 1:58 AM
gene kelley
On 12 Oct 2006 13:58:42 GMT, adalton <adal***@newsdalton.com> wrote:

>I've been trying to figure out how to test for a valid internet connection.
>I am able to connect to a valid internet connection, but when it drops, or
>if it is not there when my program starts, I get an exception.
>
>This probably is a newbie question, but I do not even know what or how I
>would trap that error.


I ran across this article the other day which you may find useful:
http://www.codeproject.com/vb/net/CC_ConnectionStatePackage.asp

Gene
Author
13 Oct 2006 6:07 PM
GhostInAK [Bastard]
Hello adalton,

I see people ask this a lot.
Who cares if there is a working internet connection.  That doesn't tell you
anything.  What you really want to know is, "Does the address I want to reach
exist from this location?".  So wrap your connection code in a Try/Catch
block and trap any connection failures.

-Boo

Show quoteHide quote
> I've been trying to figure out how to test for a valid internet
> connection. I am able to connect to a valid internet connection, but
> when it drops, or if it is not there when my program starts, I get an
> exception.
>
> This probably is a newbie question, but I do not even know what or how
> I would trap that error.
>