Home | Contact Us | Download | Support | Purchase | Products

Product List
  "Thanks so much - this component (and its support) is truly exceptional!"
R. Ifferte

TraceRoute using Events

The following example demonstrates how to perform a simple TraceRoute to the remote host, www.yahoo.com, using the event driven model.


using System;
using aspNetTraceRoute;
namespace ConsoleApplication1
	class Class1
		static void Main(string[] args)
			TraceRouteClient client = new TraceRouteClient();
			client.ReceivedReply += new ReceivedReplyEventHandler( Client_OnReply );
			client.TraceRoute( "www.yahoo.com" );

			Console.WriteLine( "done.");

		static void Client_OnReply( object sender, ReceivedReplyEventArgs e )
			//write out the response
			Console.WriteLine( e.Packet.ToString() );

			//if we wanted to cancel the traceroute, uncomment the following line
			//e.Cancel = true;



Imports System
Imports aspNetTraceRoute
Module Module1

    Sub Main()
        Dim client As New TraceRouteClient()
        AddHandler client.ReceivedReply, AddressOf Client_OnReply

    End Sub

    Sub Client_OnReply(ByVal sender As Object, ByVal e As ReceivedReplyEventArgs)
        'write out the response
        'if we want to canel the traceroute, uncomment the following line
        'e.Cancel = True

    End Sub

End Module

The box is not shipped. aspNetTraceRoute is a downloadable product.