Dart.PowerTCP.SslSockets Namespace : Trace Class (Dart.PowerTCP.SslSockets) |
The Trace component enables TraceRoute functionality in a .NET application.
For a list of all members of this type, see Trace members.
System.Object
System.MarshalByRefObject
System.ComponentModel.Component
Dart.PowerTCP.SslSockets.Trace
[Visual Basic]
<LicenseProviderAttribute(TraceLicenseProvider)>
Public Class Trace
Inherits Component
[C#]
[LicenseProviderAttribute(TraceLicenseProvider)]
public class Trace : Component
[C++]
[LicenseProviderAttribute(TraceLicenseProvider)]
public __gc class Trace : public Component
[C++/CLI]
[LicenseProviderAttribute(TraceLicenseProvider)]
public ref class Trace : public Component
The Trace component is used to trace the path a packet takes to a host. This is performed by sending a series of ICMP echo requests. The first echo request is sent with a time-to-live equal to 1. When it reaches this number (reaching the first host it arrives at, also called a hop) it will send back an error response, identifying the first host or hop. At this point an ICMP echo is sent with a time-to-live equal to 2. It will reach the second hop and send an error message identifying the host. This is repeated, incrementing the time-to-live each time, until the host is reached.
When using the Trace component, each time a new hop is reached, the Hop event is raised, supplying information to the application about the host responding for the particular hop.
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);
}
Namespace: Dart.PowerTCP.SslSockets
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Assembly: Dart.PowerTCP.SslSockets (in Dart.PowerTCP.SslSockets.dll)
Trace Members | Dart.PowerTCP.SslSockets Namespace
Send comments on this topic.
Documentation version 1.1.2.0.
© 2008 Dart Communications. All rights reserved.