See Also

Tcp Class  | Tcp Members

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows ME, Windows 2000, Windows XP, Windows Server 2003, Windows Vista

Language

Visual Basic

C#

C++

C++/CLI

Show All

See Also Languages PowerTCP Email Validation for .NET

LocalEndPoint Property

Dart.PowerTCP.EmailValidation Namespace > Tcp Class : LocalEndPoint Property (Tcp)

Returns the local address the socket is bound to.

[Visual Basic]
<DescriptionAttribute("Local IP EndPoint when the socket is connected")> <BrowsableAttribute(False)> Public ReadOnly Property LocalEndPoint As IPEndPoint
[C#]
[DescriptionAttribute("Local IP EndPoint when the socket is connected")] [BrowsableAttribute(false)] public IPEndPoint LocalEndPoint {get;}
[C++]
[DescriptionAttribute("Local IP EndPoint when the socket is connected")] [BrowsableAttribute(false)] public: __property IPEndPoint* get_LocalEndPoint();
[C++/CLI]
[DescriptionAttribute("Local IP EndPoint when the socket is connected")] [BrowsableAttribute(false)] public: property IPEndPoint^ LocalEndPoint {    IPEndPoint^ get(); }

Return Type

The local IPEndPoint that the Tcp object is using for communications.

Remarks

null is returned when the Tcp.Connected property is false. When the Tcp.Connected property is true this property returns the IPEndPoint instance representing the local address and port. If a local interface was specified using the Tcp.Connect or Tcp.BeginConnect to connect to the host, this property should reflect that interface. Otherwise this property will reflect the default interface.

To retrieve the local IP address, access Tcp.LocalEndPoint.Address. To retrieve the local port, access Tcp.LocalEndPoint.Port. As a shortcut, use the Tcp.LocalEndPoint.ToString method to return the IP address and port in address:port notation.

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 ME, Windows 2000, Windows XP, Windows Server 2003, Windows Vista

See Also

Tcp Class  | Tcp Members


Send comments on this topic.

Documentation version 1.0.3.0.

© 2008 Dart Communications.  All rights reserved.