Trace Route Program

SDavied

Active member
Joined
Aug 26, 2006
Messages
33
Location
Kansas
Programming Experience
3-5
I'm trying to write a trace route program. It needs to return:

Address of each hop
Time to each hop
Total number of hops
Total round trip time

I first thought that the Ping() class would be useful, but only for counting hops. I need some ideas on how to do this.

Scott D.
 
Being a fan of functionality over looks (due to the nature of my employment) I would write a quick app that silently called the Windows Tracert application, have that write to a tmp file, parse that temp file for the information, and display it.

Just a thought...perhaps one you hadn't considered.
 
I figured it out. I can use the Ping() class. Here's the idea:

VB.NET:
Dim pinger As New Ping()
Dim reply As New PingReply()
Dim options As New PingOptions()
Dim buffer() As Byte = System.Text.ASCIIEncoding.ASCII.GetBytes("Hello")

options.DontFragment = True
Dim i As Integer
For i = 1 To 30 'Max hops
     options.Ttl = i
     reply = pinger.Send("ipaddress", "timeout", buffer, options)
     If reply.Status <> Success
          ' ping the returned address to get time
          ' print the results to output - "Hop <i>:  <ipaddress>  <time>
     Else  ' success
          ' print out last hop - "Hop <i>:  <ipaddress> <time>
          Exit For
Next i
 
Back
Top