0

Hi All's,

I'm currently doing my project to check my server status with ping option. but i got problem to check either the network is plugged or unplugged...I need this checking automaticly using timer...here what i have done....to ping the server is success but when pulgged back the network...error come around..pls help me...

Private Sub Timer4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer4.Tick
        Timer4.Interval = 30000
        If My.Computer.Network.IsAvailable Then
            If My.Computer.Network.Ping("www.mine.my", 500) Then
                DOWN.Close()
             Else
                DOWN.Show()
             End If

        Else

            DOWN.Show()
        End If





    End Sub
2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by kerek2
0

Try This :

Function HasConnectivity() As Boolean
    Dim hostInfo As System.Net.IPHostEntry
    Try 'to look for the logon server
        Dim sServer As String = Environment.GetEnvironmentVariable("logonserver")
        hostInfo = System.Net.Dns.GetHostByName(sServer.Remove(0, 2))
        Return True
    Catch 'theres no network connection
        Return False
    End Try
End Function

For Checking :

If HasConnectivity() = True Then
   ' Your Ping Code
Else
   MsgBox("not connected")
End If
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.