See Also

HopResult Class  | HopResult Members

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Language

Visual Basic

C#

C++

C++/CLI

Show All

See Also Languages PowerTCP SSL Sockets for .NET

TTL Property

Dart.PowerTCP.SslSockets Namespace > HopResult Class : TTL Property (HopResult)

Returns the time-to-live for this hop.

[Visual Basic]
Public Property TTL As Integer
[C#]
public int TTL {get; set;}
[C++]
public: __property int get_TTL(); public: __property void set_TTL(    int value );
[C++/CLI]
public: property int TTL {    int get();    void set (int value); }

Return Type

An integer representing the time-to-live for this hop.

Remarks

A trace route operation works by first sending an ICMP packet to a host with a time-to-live of 1. At the first host the packet reaches (or hop), the time-to-live is 0 and an ICMP packet will be returned to the sending host. An ICMP packet is then sent with a time-to-live of 2. This causes the second host the packet reaches to send an ICMP packet to the sending host. This continues, incrementing time-to-live each time, until the host is reached or until MaxHops is reached. The HopResult.TTL property returns the time-to-live for this hop.

Example

The following example demonstrates a basic trace route operation.

[Visual Basic] 

Private Sub TraceTest()
   ' Set all hops and echoes to be synchronous
   Trace1.HopType = HopType.SynchHops

   ' Do not exceed 25 hops
   Trace1.MaxHops = 25

   ' Trace the route. Trace.Hop event will be raised when new hop data is available
   Dim tr As TraceResult = Trace1.Send("www.dart.com")

   ' Trace route complete. Display some data.
   Debug.WriteLine("Average time for final hop: " & tr.AverageTime)
   Debug.WriteLine("Number of hops: " & tr.Hops.Length)
   Debug.WriteLine("Remote Address: " & tr.RemoteAddress)
End Sub

Private Sub Trace1_Hop(ByVal sender As Object, ByVal e As HopEventArgs) Handles Trace1.Hop
   ' Display information about the hop
   Debug.WriteLine("Time-to-live for the hop: " & e.Result.TTL)
   Debug.WriteLine("Remote address: " & e.Result.RemoteAddress)

   ' Now display info about each of the three echoes
   Debug.WriteLine("Response times for this hop")
   Dim er As EchoResult
   For Each er In e.Result.Echoes
      Debug.WriteLine(er.ResponseTime)
   Next

   Debug.WriteLine("Average time for this hop: " & e.Result.AverageTime)
End Sub

[C#] 


private void TraceTest()
{
  
// Set all hops and echoes to be synchronous
  
trace1.HopType = HopType.SynchHops;

  
// Do not exceed 25 hops
  
trace1.MaxHops = 25;

  
// Trace the route. Trace.Hop event will be raised when new hop data is available
  
TraceResult tr = trace1.Send("www.dart.com");

  
// Trace route complete. Display some data.
  
Debug.WriteLine("Average time for final hop: " + tr.AverageTime);
  Debug.WriteLine(
"Number of hops: " + tr.Hops.Length);
  Debug.WriteLine(
"Remote Address: " + tr.RemoteAddress);
}

private void trace1_Hop(object sender, HopEventArgs e)
{
  
// Display information about the hop
  
Debug.WriteLine("Time-to-live for the hop: " + e.Result.TTL);
  Debug.WriteLine(
"Remote address: " + e.Result.RemoteAddress);

  
// Now display info about each of the three echoes
  
Debug.WriteLine("Response times for this hop");
  
foreach(EchoResult er in e.Result.Echoes)
     Debug.WriteLine(er.ResponseTime);

  Debug.WriteLine(
"Average time for this hop: " + e.Result.AverageTime);
}
                

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

HopResult Class  | HopResult Members


Send comments on this topic.

Documentation version 1.1.2.0.

© 2008 Dart Communications.  All rights reserved.