See Also

Tcp Class  | Tcp 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

EndConnect Event

Dart.PowerTCP.SslSockets Namespace > Tcp Class : EndConnect Event

Raised when the BeginConnect request completes.

[Visual Basic]
<CategoryAttribute("Connection")> <DescriptionAttribute("Raised when the BeginConnect() request completes")> Public Event EndConnect() As ConnectEventHandler
[C#]
[CategoryAttribute("Connection")] [DescriptionAttribute("Raised when the BeginConnect() request completes")] public event ConnectEventHandler EndConnect();
[C++]
[CategoryAttribute("Connection")] [DescriptionAttribute("Raised when the BeginConnect() request completes")] public: __event ConnectEventHandler* EndConnect();
[C++/CLI]
[CategoryAttribute("Connection")] [DescriptionAttribute("Raised when the BeginConnect() request completes")] public: event ConnectEventHandler^ EndConnect();

Event Data

The event handler receives an argument of type ExceptionEventArgs containing data related to this event. The following ExceptionEventArgs properties provide information specific to this event.

PropertyDescription
Exception Gets any exception which occurred during the asynchronous operation.
State Gets the object that was included as part of the associated method call.

Remarks

This event is raised when the asynchronous method call BeginConnect completes. An EventArgs object is passed into the event, containing information about the event.

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 Tcp component as a reference, you must create a method to handle the event yourself.

This event MUST be implemented if you are using the BeginConnect method.

Example

The following example demonstrates asynchronously connecting using the BeginConnect method.

[Visual Basic] 

Private Sub Test()
   ' Begin to asynchronously connect to an echo port.
   Tcp1.BeginConnect("atropos", 7)
End Sub

Private Sub Tcp1_EndConnect(ByVal sender As Object, ByVal e As ExceptionEventArgs) Handles Tcp1.EndConnect
   ' Connect complete, check for any exceptions
   If e.Exception Is Nothing Then
      ' Now send some data.
      Tcp1.Send("hello")

      ' Receive the data back.
      Dim seg As Segment = Tcp1.Receive()
      Debug.WriteLine(seg.ToString())
   End If
End Sub

[C#] 


private void Test()
{
  
// Begin to asynchronously connect to an echo port.
  
tcp1.BeginConnect("atropos", 7);
}

private void tcp1_EndConnect(object sender, ExceptionEventArgs e)
{
  
// Connect complete, check for any exceptions
  
if(e.Exception == null)
  {
     
// Now send some data.
     
tcp1.Send("hello");

     
// Receive the data back.
     
Segment seg = tcp1.Receive();

     Debug.WriteLine(seg.ToString());
  }
}
                

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

Tcp Class  | Tcp Members


Send comments on this topic.

Documentation version 1.1.2.0.

© 2008 Dart Communications.  All rights reserved.