Home All Groups Group Topic Archive Search About

Determine Internet Connection

Author
13 Jan 2005 12:25 AM
Brett Robichaud
This may be an obvious/stupid question, but I was unable to google an
answer.

How can I tell if an Internet connection is available?  My app cannot count
on a connection always being there and before I start a ftp or http request
I want to check for basic connectivity.

Author
13 Jan 2005 3:21 AM
Steven Cheng[MSFT]
Hi Brett,

Thanks for your posting. As for the question you mentioned I think there're
serveral means we can do and generally the following two are ok:

1. If you want to check whether your client machine is online or OFFline,
you can consider using some WIN32 api to detect the network status, you can
have a look at the .net's smart client offline application block to see how
it works:

#Smart Client Offline Application Block
http://msdn.microsoft.com/library/en-us/dnpag/html/offline.asp?frame=true

2. If what you want to detect is a particular remote url or site, you can
consider using the HttpWebRequest class to send a simple get request the
the destination url. If that remote service is asseccible you'll get some
info such as success or fail status code.

Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Author
13 Jan 2005 5:48 PM
Brett Robichaud
Thanks, the Smart Client App Block should have what I'm after.

-Brett-

Show quote
"Steven Cheng[MSFT]" <v-sch***@online.microsoft.com> wrote in message
news:dn4qP8R%23EHA.3048@cpmsftngxa10.phx.gbl...
> Hi Brett,
>
> Thanks for your posting. As for the question you mentioned I think
> there're
> serveral means we can do and generally the following two are ok:
>
> 1. If you want to check whether your client machine is online or OFFline,
> you can consider using some WIN32 api to detect the network status, you
> can
> have a look at the .net's smart client offline application block to see
> how
> it works:
>
> #Smart Client Offline Application Block
> http://msdn.microsoft.com/library/en-us/dnpag/html/offline.asp?frame=true
>
> 2. If what you want to detect is a particular remote url or site, you can
> consider using the HttpWebRequest class to send a simple get request the
> the destination url. If that remote service is asseccible you'll get some
> info such as success or fail status code.
>
> Thanks.
>
> Regards,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
>
Author
14 Jan 2005 1:02 AM
Steven Cheng[MSFT]
You're welcome Brett,

Enjoy the SCAB :)

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

AddThis Social Bookmark Button