469,280 Members | 2,053 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,280 developers. It's quick & easy.

How can I check internet connection in vb

Hi all,
I am writing a program with vb.net which getting some information from
internet. I must check internet connection before some prosess.
But how?
Jul 19 '05 #1
2 24907
The WebRequest class throws a WebException when errors occur while accessing
an Internet resource, so just try to connect and trap any erro that arises.

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Kadir CAMOGLU" <ka******@hotmail.com> wrote in message
news:uK**************@tk2msftngp13.phx.gbl...
Hi all,
I am writing a program with vb.net which getting some information from
internet. I must check internet connection before some prosess.
But how?

Jul 19 '05 #2
just call above ftn which returns true or false


--------*********--------
Private Function IsConnectionAvailable() As Boolean
'Call url
Dim url As New System.Uri("http://www.google.com/")
'Request for request
Dim req As System.Net.WebRequest
req = System.Net.WebRequest.Create(url)
Dim resp As System.Net.WebResponse
Try
resp = req.GetResponse()
resp.Close()
req = Nothing
Return True
Catch ex As Exception
req = Nothing
Return False
End Try
End Function
May 31 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Matt Hawley | last post: by
3 posts views Thread by Jonny | last post: by
2 posts views Thread by Ron Vecchi | last post: by
1 post views Thread by Kadir CAMOGLU | last post: by
8 posts views Thread by Nikola Bucic | last post: by
4 posts views Thread by Goldwind | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.