Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[TuToRiAl] How to Check if theres any Internet Connection [TuToRiAl]
#11
Whats wrong with:
Code:
If My.Computer.Network.IsAvailable = True Then
    MsgBox("Computer is connected.")
Else  
    MsgBox("Computer is not connected.")
End If

Much simpler and does the task...
Reply
#12
(01-11-2011, 02:37 AM)andrew Wrote: Whats wrong with:
Code:
If My.Computer.Network.IsAvailable = True Then
    MsgBox("Computer is connected.")
Else  
    MsgBox("Computer is not connected.")
End If

Much simpler and does the task...

Thats the n00by way, my way is more accurate hehehehe...
[Image: t5BWm.png]
Reply
#13
(01-11-2011, 05:17 PM)L3g1tWa5te Wrote: Thats the n00by way, my way is more accurate hehehehe...

That is not the "n00by way". It's actually a very simple way that would work 90% of the time. The only thing wrong with
Code:
If My.Computer.Network.IsAvailable = True Then

is this code will still return true if you have a LAN connection, and no internet connection.

So to make it work 100% of the time, ping the modem to check if it's up. (You could ping google, but in the very slim chance that google went down, this would still work.) So the most accurate way with far less code is to use:.
Code:
If My.Computer.Network.IsAvailable And My.Computer.Network.Ping("192.168.100.1") Then
    'Internet is avail
Else
    'Internet is not avail
End If

WebClient would even produce the same results as WebRequest (used in the OP) but with less code.
Reply
#14
(01-11-2011, 09:18 PM)KoBE Wrote:
Code:
If My.Computer.Network.IsAvailable And My.Computer.Network.Ping("192.168.100.1") Then
    'Internet is avail
Else
    'Internet is not avail
End If

Actually, the most accurate way to know if you have any internet access is to would be: 192.168.1.1

Easiest and Fastest method. Figured that on my own Big GrinDD
[Image: t5BWm.png]
Reply
#15
(01-11-2011, 09:35 PM)L3g1tWa5te Wrote: Actually, the most accurate way to know if you have any internet access is to would be: 192.168.1.1
Easiest and Fastest method. Figured that on my own Big GrinDD

You know that is the default address for linksys routers right?
Reply
#16
Thanks for the tutorial Smile
[Image: qMBBR2p.png]
Reply
#17
My way also works, it's smaller and can be modified to set a timeout. (The 2000 is how much time it'll take to try to ping before timing out)

Code:
If My.Computer.Network.Ping("http://www.google.com", 2000) Then
            MsgBox("Connected")
Else
            MsgBox("Not Connected")
End If
Reply
#18
(01-12-2011, 03:13 PM)iBored1x1 Wrote: My way also works, it's smaller and can be modified to set a timeout. (The 2000 is how much time it'll take to try to ping before timing out)

Code:
If My.Computer.Network.Ping("http://www.google.com", 2000) Then
            MsgBox("Connected")
Else
            MsgBox("Not Connected")
End If

Ok one more time, here is the best website that should always be up if you have any internet connection: your effing router. 192.168.1.1
[Image: t5BWm.png]
Reply
#19
(01-12-2011, 08:28 PM)L3g1tWa5te Wrote: Ok one more time, here is the best website that should always be up if you have any internet connection: your effing router. 192.168.1.1

And if you don't use a router? Then your code would definitely fail. Even if you did have a router, you still may not have an internet connection. Once again, your code would fail.
Reply
#20
(01-12-2011, 09:38 PM)KoBE Wrote: And if you don't use a router? Then your code would definitely fail. Even if you did have a router, you still may not have an internet connection. Once again, your code would fail.

I already know that when I was typing that response bro, chillax. I was too lazy to think of a another way to use. I suppose google is as good as it gets.
[Image: t5BWm.png]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [HELP]Tutorial/Learning System[HELP] norBATman 2 1,327 09-08-2012, 10:17 PM
Last Post: AceInfinity
  [TuToRiAl] How to make Offline (No Internet) Captcha (Human Confirmation) [TuToRiAl] Resistance 24 12,674 08-30-2012, 10:14 PM
Last Post: Resistance
  [Visual Basic] FTP Uploader [Tutorial] Coding Support 6 3,042 08-12-2012, 12:36 AM
Last Post: Kenneth
  [RELEASE]SF-TutPad "Tutorial Editor" [RELEASE] Digital-Punk 28 10,310 08-11-2012, 11:25 PM
Last Post: Kenneth
  Emailer Tutorial dunlop03 12 2,901 06-24-2012, 04:33 AM
Last Post: kpn37z

Forum Jump:


Users browsing this thread: 6 Guest(s)