Click here to Skip to main content
15,889,335 members
Articles / Web Development / ASP.NET
Alternative
Tip/Trick

Checking Internet Is Connected Or Not From .NET

Rate me:
Please Sign up or sign in to vote.
4.53/5 (9 votes)
27 May 2011CPOL 10.6K   3   4
Dim value As Boolean = My.Computer.Network.IsAvailable can be used in a situation where the only network a system will be connected to is the Internet.Dim value As Boolean = My.Computer.Network.Ping(hostNameOrAddress ,timeout) hostNameOrAddress can be any valid website -...
VB
Dim value As Boolean = My.Computer.Network.IsAvailable
can be used in a situation where the only network a system will be connected to is the Internet.
VB
Dim value As Boolean = My.Computer.Network.Ping(hostNameOrAddress ,timeout) 

hostNameOrAddress can be any valid website - "www.google.com"
timeout (Int32). Time threshold in milliseconds for contacting the destination. Default is 500.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Student
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralReason for my vote of 5 best code Pin
beginner201127-Dec-11 15:31
beginner201127-Dec-11 15:31 
GeneralReason for my vote of 1 best & easiest & managed code Pin
Kraeven6-Dec-11 22:33
Kraeven6-Dec-11 22:33 
GeneralRe: I think you voted 1 for this accidentally(Based on your comm... Pin
thatraja26-Dec-11 20:15
professionalthatraja26-Dec-11 20:15 
GeneralReason for my vote of 5 This is the absolute simplest method... Pin
Bryan@DataLabs6-Dec-11 6:55
Bryan@DataLabs6-Dec-11 6:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.