Google
 
Web undim.blogspot.com
Visual Basic developer's world

Saturday, July 07, 2007
Undocumented : How to check if a website (or your blog) is alive
Use this undocumented method IsDestinationReachable located in sensapi.dll to check if your blog or a website in general is alive.

The debug window will display the connection path, the speed and True or False if the site destination is reachable.



Option Explicit

Private Type QOCINFO
dwSize As Long
dwFlags As Long
dwInSpeed As Long
dwOutSpeed As Long
End Type

Public MonInterval As Long

Private Const NETWORK_ALIVE_LAN As Long = &H1 'active LAN cards
Private Const NETWORK_ALIVE_WAN As Long = &H2 'active RAS connections
Private Const NETWORK_ALIVE_AOL As Long = &H4 'connected to AOL (Win95/98 only)

Private Declare Function IsDestinationReachable Lib "sensapi.dll" _
Alias "IsDestinationReachableA" (ByVal lpszDestination As String, _
lpQOCInfo As QOCINFO) As Long
Public Function CheckSite(ByVal strHTTPSite As String) As Boolean
Dim gRes As Long
Dim structqoc As QOCINFO

structqoc.dwSize = Len(structqoc)

gRes = IsDestinationReachable(strHTTPSite, structqoc)

With structqoc
Select Case .dwFlags
Case NETWORK_ALIVE_LAN: Debug.Print "LAN"
Case NETWORK_ALIVE_WAN: Debug.Print "RAS"
Case NETWORK_ALIVE_AOL: Debug.Print "AOL"
Case Else: Debug.Print "Unknown"
End Select

Debug.Print "IN:" & FormatNumber((.dwInSpeed / 1000), 0) & " kbps OUT:" & FormatNumber((.dwOutSpeed / 1000), 0) & " kbps"
End With

CheckSite = CBool(gRes)

End Function


Visual Basic still rocks :)

Labels: , ,


posted by Admin @ 10:30 PM   0 comments

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 
About Me

Name: Admin
Home: The NeverLands
About Me: A source code wonderer since the early 80s with my first ZX81 by Sinclair, home computer.
See my complete profile
Previous Post
Archives
Must-See Places
ΣΚΛΗΡΥΝΣΗ ΚΑΤΑ ΠΛΑΚΑΣ - ΕΓΚΕΦΑΛΟΣ - ΕΓΚΕΦΑΛΟΓΡΑΦΗΜΑ - ΑΝΟΙΑ - ΝΕΥΡΟΛΟΓΟΣ - ΨΥΧΙΑΤΡΟΣ - ΛΟΙΜΩΔΗΣ ΜΟΝΟΠΥΡΗΝΩΣΗ - ΠΑΡΚΙΝΣΟΝ - ΑΓΧΟΣ - ΚΑΤΑΘΛΙΨΗ - ALZHEIMER - EPSTEIN BARR eurolife
e-LaUgHs :-)
Template By
Free Blogger templates