Is Host OnLine
Determines if a given host (hostname or IP address) is reachable within the specified timeout period.
Uses the Net.NetworkInformation.Ping class to send an ICMP echo request (“ping”) to the specified host. If an exception occurs (e.g., host not found or network error), the function returns False.
VB
Public Function IsHostOnLine(Host As String,
Optional Timeout As Integer = 1000) As Boolean
Try
Dim ping As New Net.NetworkInformation.Ping()
Dim reply As Net.NetworkInformation.PingReply = ping.Send(Host, Timeout)
Return reply.Status = Net.NetworkInformation.IPStatus.Success
Catch
Return False
End Try
End Function