Glossary Item Box

PowerTCP SSL Sockets for .NET

Using EndXXX Events

An EndXXX event is a generic term to describe any event used by PowerTCP Sockets for .NET that begins with the word "End". These events are reserved to notify the application of a process being completed. In addition, all EndXXX events are raised by the completion of a corresponding BeginXXX method. The EndXXX events used by PowerTCP SSL Sockets for .NET components are as follows:

Event Raised By Purpose
EndConnected Event Use of the BeginConnect method Notifies the application that a the Tcp component is connected.
EndReceive event Use of the BeginReceive method Notifies the application that data has been received.
EndSend event Use of the BeginSend method Notifies the application that data has been asynchronously sent.
EndReceive event Use of the BeginReceive method Notifies the application that data has been received.
EndSend event Use of the BeginSend method Notifies the application that data has been asynchronously sent.
EndGetHost event Use of the BeginGetHost method Notifies the application that a host or IP address has been resolved, successfully or unsuccessfully.
EndGetMailHosts event Use of the BeginGetMailHosts method Notifies the application that an email address has been resolved, successfully or unsuccessfully.
EndSend event Use of the BeginSend method Notifies the application that an asynchronous ping operation has completed.
EndSend event Use of the BeginSend method Notifies the application that an asynchronous trace route operation has completed.

 

Comparison With Other Techniques:

PowerTCP products employ a unique technique for handling asynchronous completion notification:

  1. As compared to using the delegate technique, by using Events for completion notification, PowerTCP gives developers strong environment support for adding event handlers. For example (using the Tcp component as an example):
  2. Before raising the completion event, the component calls the (internal) delegate's EndReceive method, capturing any Exceptions thrown during asynchronous execution. Using this technique, PowerTCP ensures that all asynchronous calls are properly terminated, and consequently eliminates one programming step that would normally have to be accomplished by our users.
  3. When any BeginXXX method is used, PowerTCP checks for the appropriate event handler and throws an InvalidOperationException if none is found. This action ensures proper usage.

We believe that this approach has made asynchronous communications programming as easy as it gets, providing our users with superior value.

 

Special Notes About EndXXX Events:

Be sure to check the e.Exception property for exceptions that occurred during the asynchronous method call. If the operation failed to complete, the presence of an Exception object may be your only indication that the operation failed.

It is a very good programming practice to surround your event code with a try/catch block. If you do not do so and generate an exception within your code, a default exception handler will display your exception to the user of your application using a MessageBox.

 

In This Section

The Server and Tcp Components
Examines use of the Server and Tcp components.
The Udp Component
Examines use of the Udp component.
The Dns, Ping and Trace Components
Examines use of the Dns, Ping and Trace components.
Security
Describes use of security.
Synchronous vs Asynchronous Methods
This topic discusses the benefits and uses for synchronous and asynchronous methods.
Using EndXXX Events
Describes how to use the EndXXX events that are raised upon the completion of a method.
Using Editor Forms
Describes how to use the component designer Editor Forms.

 

 


Send comments on this topic.

Documentation version 1.1.2.0.

© 2008 Dart Communications.  All rights reserved.