Dart.PowerTCP.SslSockets Namespace > Trace Class : EndSend Event (Trace) |
Raised when the BeginSend request completes.
[Visual Basic]
<CategoryAttribute("Completion")>
<DescriptionAttribute("Raised when the BeginSend() request completes")>
Public Event EndSend() As TraceEventHandler
[C#]
[CategoryAttribute("Completion")]
[DescriptionAttribute("Raised when the BeginSend() request completes")]
public event TraceEventHandler EndSend();
[C++]
[CategoryAttribute("Completion")]
[DescriptionAttribute("Raised when the BeginSend() request completes")]
public: __event TraceEventHandler* EndSend();
[C++/CLI]
[CategoryAttribute("Completion")]
[DescriptionAttribute("Raised when the BeginSend() request completes")]
public:
event TraceEventHandler^ EndSend();
The event handler receives an argument of type TraceEventArgs containing data related to this event. The following TraceEventArgs properties provide information specific to this event.
Property | Description |
---|---|
Exception | Gets any exception which occurred during the asynchronous operation. |
Result | Returns a TraceResult object encapsulating data about the asynchronous trace route operation. |
State | Gets the object that was included as part of the associated method call. |
This event is raised when the asynchronous method call BeginSend completes. A TraceEventArgs object is passed into the event, containing information about the asynchronous operation, such as a collection representing each hop of the trace operation.
If any errors occurred during the asynchronous operation, they would be returned in the TraceEventArgs object, check Exception to check for any exception.
For more information on using events using PowerTCP.NET within the Visual Studio.NET environment, see the topic, Using Events In PowerTCP.
If you are using the Trace component as a reference, you must create a method to handle the event yourself.
This event MUST be implemented if you are using the BeginSend method.
The following example demonstrates an asynchronous 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
' Begin the trace route operation.
Trace1.BeginSend("www.dart.com", Nothing)
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
Private Sub Trace1_EndSend(ByVal sender As Object, ByVal e As TraceEventArgs) Handles Trace1.EndSend
' Check for any exceptions
If e.Exception Is Nothing Then
' Trace operation is complete, display info.
Debug.WriteLine("Total hops: " & e.Result.Hops.Length)
Else
Debug.WriteLine("Exception: " & e.Exception.Message)
End If
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;
// Begin the trace route operation.
Trace1.BeginSend("www.dart.com", null);
}
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);
}
private void trace1_EndSend(object
sender, TraceEventArgs e)
{
// Check for any exceptions
if(e.Exception == null)
// Trace operation completed successfully, display info.
Debug.WriteLine("Total hops: " +
e.Result.Hops.Length);
else
Debug.WriteLine("Exception: " +
e.Exception.Message);
}
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Send comments on this topic.
Documentation version 1.1.2.0.
© 2008 Dart Communications. All rights reserved.