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

ConnectedChangedEx Event

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

Raised when the value of the Object.Connected property changes. Supersedes the ConnectedChanged event.

[Visual Basic]
<CategoryAttribute("Connection")> <DescriptionAttribute("Raised when the value of the Connected property changes.")> Public Event ConnectedChangedEx() As EventHandlerEx
[C#]
[CategoryAttribute("Connection")] [DescriptionAttribute("Raised when the value of the Connected property changes.")] public event EventHandlerEx ConnectedChangedEx();
[C++]
[CategoryAttribute("Connection")] [DescriptionAttribute("Raised when the value of the Connected property changes.")] public: __event EventHandlerEx* ConnectedChangedEx();
[C++/CLI]
[CategoryAttribute("Connection")] [DescriptionAttribute("Raised when the value of the Connected property changes.")] public: event EventHandlerEx^ ConnectedChangedEx();

Remarks

This event is raised when the value of the Object.Connected property changes. The value of the Object.Connected property changes whenever a TCP connection to a resource is either made or closed.

This event is useful in several scenarios, for example:

If you are using the PowerTCP component as a reference, you must create a method to handle the event yourself. For more information on using events using PowerTCP.NET within the Visual Studio.NET environment, see Using Events In PowerTCP.

Example

The following example demonstrates using the ConnectedChanged event to notify the user of the status of the connection.

[Visual Basic] 

Private Sub Tcp1_ConnectedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Tcp1.ConnectedChanged
   ' Get current state of connection
   If Tcp1.Connected Then
      Debug.WriteLine("Connection made")

      ' Display info about the local/remote endpoints
      Debug.WriteLine("Local endpoint: " + Tcp1.LocalEndPoint.ToString())
      Debug.WriteLine("Remote endpoint: " + Tcp1.RemoteEndPoint.ToString())
   Else
      Debug.WriteLine("Connection closed")
   End If
End Sub

[C#] 


private void tcp1_ConnectedChanged(object sender, System.EventArgs e)
{
   
// Get current state of connection
   
if(tcp1.Connected)
   {
       Debug.WriteLine(
"Connection made");

       
// Display info about the local/remote endpoints
       
Debug.WriteLine("Local endpoint: " + tcp1.LocalEndPoint.ToString());
       Debug.WriteLine(
"Remote endpoint: " + tcp1.RemoteEndPoint.ToString());
   }
   
else
       
Debug.WriteLine("Connection closed");
}
                

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.