Home All Groups Group Topic Archive Search About

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

Author
14 Oct 2006 10:55 PM
Robert
From: "Stacey" <StaceyL@community.nospam>

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.

==========================================
From: gene kelley <o***@by.me>

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

Gene
================================================

From: GhostInAK [Bastard] <p***@paco.net>

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

================================================

From: "Michel Posseth  [MCP]" <M***@posseth.com>

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]
============================================

From: "Adalton"

I appreciate the great suggestions.  All I really need to do is see if the internet
connection is active before I try to connect to a remote server.  The solution must
work in VB.Net 2003 and 2005.

Author
15 Oct 2006 12:51 AM
rowe_newsgroups
Personally, I like Ghosts suggestion the best. Why worry about one
reason that you cant connect to the database (whether or not the
internet connection exists) when you could trap all the problems in one
try..catch block. Is there a reason you dont want to use this
suggestion?

Thanks,

Seth Rowe


Robert wrote:
Show quoteHide quote
> From: "Stacey" <StaceyL@community.nospam>
>
> 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.
>
> ==========================================
> From: gene kelley <o***@by.me>
>
> I ran across this article the other day which you may find useful:
http://www.codeproject.com/vb/net/CC_ConnectionStatePackage.asp
>
> Gene
> ================================================
>
> From: GhostInAK [Bastard] <p***@paco.net>
>
> 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
>
> ================================================
>
> From: "Michel Posseth  [MCP]" <M***@posseth.com>
>
> 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]
> ============================================
>
> From: "Adalton"
>
> I appreciate the great suggestions.  All I really need to do is see if the internet
> connection is active before I try to connect to a remote server.  The solution must
> work in VB.Net 2003 and 2005.