VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Determine if Connected to Internet (even through network)

by Mike Dryden (1 Submission)
Category: Internet/HTML
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (3 Votes)

Simple way to tell if a user is connected to the internet

Assumes
Assume MS Winsock control is added to app with name Winsock1 you can replace www.yahoo.com with any site you want, just make sure its on the net somewhere...

Rate Determine if Connected to Internet (even through network)

Public Sub CheckIfConnected()
 Winsock1.Close
 Winsock1.Connect "www.yahoo.com", 80
 
 While Winsock1.state <> sckConnected
  If Winsock1.state = sckError Then GoTo Offline
  DoEvents
 Wend
 
 MsgBox "Online"
 Winsock1.Close
 Exit Sub
Offline:
 MsgBox "Offline"
End Sub

Download this snippet    Add to My Saved Code

Determine if Connected to Internet (even through network) Comments

No comments have been posted about Determine if Connected to Internet (even through network). Why not be the first to post a comment about Determine if Connected to Internet (even through network).

Post your comment

Subject:
Message:
0/1000 characters