Dim tcpClient As New TcpClient()
Dim myIP As IPAddress = IPAddress.Parse("192.168.0.254")
Try
'You can change the Port 80 to whatever port you wish to hit (i.e.8080)
tcpClient.Connect(myIP, 80)
MessageBox.Show("Ping is OK")
Catch err As Exception
'Do what you want in here if the ping is unsuccessful
MessageBox.Show("Ping is not OK")
End Try
Dim tcpClient As New System.Net.Sockets.TcpClient()
Dim myIP As System.Net.IPAddress = System.Net.IPAddress.Parse("192.168.0.254")
Try
'You can change the Port 80 to whatever port you wish to hit (i.e.8080)
tcpClient.Connect(myIP, 80)
MessageBox.Show("Ping is OK")
Catch err As Exception
'Do what you want in here if the ping is unsuccessful
MessageBox.Show("Ping is not OK")
End Try
divil said:That's not a ping. You can create a real ICMP ECHO packet and send it with the .NET framework and the Socket class, see the URL below for an application written in C# to do this.
ICMP Ping using .NET Framework