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

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

thank you...i'm will try it....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.