Module sping
Sub ping(ByVal ip As String, ByVal popis As String)
Try
Dim png = My.Computer.Network.Ping(ip)
If png = True Then
Console.Write("Server " & popis & " (" & ip & ") .... ")
Console.ForegroundColor = ConsoleColor.DarkGreen
Console.Write("ok")
Console.ForegroundColor = ConsoleColor.Gray
Console.Write(vbCrLf)
ElseIf png = False Then
Console.Write("Server " & popis & " (" & ip & ") .... ")
Console.ForegroundColor = ConsoleColor.Red
Console.Write("error")
Console.ForegroundColor = ConsoleColor.Gray
Console.Write(vbCrLf)
End If
Catch ex As Exception
Console.Write(" (" & ex.Message & ")")
Console.Write(vbCrLf)
End Try
End Sub
Sub Main()
Console.Clear()
Console.WriteLine("Try servers:")
Console.Write(vbCrLf)
ping("148.13.210.11", "web")
ping("192.168.0.2", "another server")
Console.Read()
End Sub
End Module
|