Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.
Pinging another computer
From Wiki
For the 2.0 framework you will find this in the My namespace
- If My.Computer.Network.Ping("127.0.0.1") Then
- 'the computer was there
- Else
- 'the computer wasn't available
- End If
And here is a more elaborate example where you can get a lot more information then just ok or not ok like above.
- Imports System
- Imports System.Net
- Imports System.Net.NetworkInformation
- Namespace PingProc
- Public Class Program
- Public Sub Main()
- Ping("127.0.0.1")
- 'Ping("cnn.com")
- End Sub
- Public Function Ping(ByVal hostname As String) As Integer
- Dim _ping As Ping = New Ping()
- Dim _reply As PingReply = _ping.Send(hostname)
- If _reply.Status = IPStatus.Success Then
- Console.WriteLine("Address: {0}", _reply.Address)
- Console.WriteLine("RoundTrip Time: {0}", _reply.RoundtripTime)
- Console.WriteLine("Time To Live: {0}", _reply.Options.Ttl)
- Console.WriteLine("Don't Fragment: {0}", _reply.Options.DontFragment)
- Console.WriteLine("Buffer Size: {0}", _reply.Buffer.Length)
- Console.WriteLine("Status: {0}", _reply.Status)
- Console.ReadLine()
- Return (0)
- Else
- Console.WriteLine("Error")
- Console.WriteLine("Status: {0}", _reply.Status)
- Console.ReadLine()
- Return (1)
- End If
- End Function
- End Class
- end namespace



LTD Social Sitings
Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.