Home All Groups Group Topic Archive Search About

How to test internet connection in VB.NET?

Author
30 May 2006 10:12 PM
John Riddle
Hello,

I have an application that runs continously gives an error and stops working
if the internet goes down (which happens for about 5-10 minutes several times
a day. Can anybody tell me how to test for internet connectivity when this
happens and then pause processing until internet connectivity is back up?

Thanks.

Author
30 May 2006 10:26 PM
Mehdi
On Tue, 30 May 2006 15:12:02 -0700, John Riddle wrote:

> I have an application that runs continously gives an error and stops working
> if the internet goes down (which happens for about 5-10 minutes several times
> a day. Can anybody tell me how to test for internet connectivity when this
> happens and then pause processing until internet connectivity is back up?

Open a connection to a server garanteed to be up 24/7 such as
microsoft.com, apple.com or google.com. If the connection succeeds, your
Internet connection is up. If it fails, you might want to try out another
site first before declaring that the connection has been lost though.
Author
31 May 2006 6:52 PM
John Riddle
Thanks guys. Tried Mehdi's response and it worked great.

Thanks.


Try

Show quoteHide quote
"Mehdi" wrote:

> On Tue, 30 May 2006 15:12:02 -0700, John Riddle wrote:
>
> > I have an application that runs continously gives an error and stops working
> > if the internet goes down (which happens for about 5-10 minutes several times
> > a day. Can anybody tell me how to test for internet connectivity when this
> > happens and then pause processing until internet connectivity is back up?
>
> Open a connection to a server garanteed to be up 24/7 such as
> microsoft.com, apple.com or google.com. If the connection succeeds, your
> Internet connection is up. If it fails, you might want to try out another
> site first before declaring that the connection has been lost though.
>
Author
31 May 2006 12:06 AM
Homer J Simpson
"John Riddle" <JohnRid***@discussions.microsoft.com> wrote in message
news:7E3CF9A1-F411-4A73-972F-F7D8567500DE@microsoft.com...

> I have an application that runs continously gives an error and stops
> working
> if the internet goes down (which happens for about 5-10 minutes several
> times
> a day. Can anybody tell me how to test for internet connectivity when this
> happens and then pause processing until internet connectivity is back up?

Maybe shell 'ping' and see what happens?
Author
31 May 2006 5:28 AM
Cor Ligthert [MVP]
John,

Try the first IP next after your router.

http://msdn2.microsoft.com/en-us/library/system.net.networkinformation.ping.aspx

http://msdn2.microsoft.com/en-us/library/he5sca5t.aspx

I hope this helps,

Cor

Show quoteHide quote
"John Riddle" <JohnRid***@discussions.microsoft.com> schreef in bericht
news:7E3CF9A1-F411-4A73-972F-F7D8567500DE@microsoft.com...
> Hello,
>
> I have an application that runs continously gives an error and stops
> working
> if the internet goes down (which happens for about 5-10 minutes several
> times
> a day. Can anybody tell me how to test for internet connectivity when this
> happens and then pause processing until internet connectivity is back up?
>
> Thanks.