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();
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.
Property | Description |
---|---|
Exception | Gets any exception which occurred during the asynchronous operation. |
State | Gets the object that was included as part of the associated method call. |
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.
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());
}
}
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.