Dart.PowerTCP.SslSockets Namespace > Tcp Class : RemoteEndPoint Property (Tcp) |
Returns the remote address/port the socket is connected to.
[Visual Basic]
<BrowsableAttribute(False)>
<DescriptionAttribute("Returns the remote address/port the socket is connected to.")>
Public ReadOnly Property RemoteEndPoint As IPEndPoint
[C#]
[BrowsableAttribute(false)]
[DescriptionAttribute("Returns the remote address/port the socket is connected to.")]
public IPEndPoint RemoteEndPoint {get;}
[C++]
[BrowsableAttribute(false)]
[DescriptionAttribute("Returns the remote address/port the socket is connected to.")]
public: __property IPEndPoint* get_RemoteEndPoint();
[C++/CLI]
[BrowsableAttribute(false)]
[DescriptionAttribute("Returns the remote address/port the socket is connected to.")]
public:
property IPEndPoint^ RemoteEndPoint {
IPEndPoint^ get();
}
The remote IPEndPoint that the Tcp object is using for communications.
null is returned when the Connected property is false. When the Connected property is true this property returns the IPEndPoint instance representing the remote address and port.
To retrieve the remote IP address, access Tcp.RemoteEndPoint.Address. To retrieve the remote port, access Tcp.RemoteEndPoint.Port. As a shortcut, use the Tcp.RemoteEndPoint.ToString method to return the IP address and port in address:port notation.
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");
}
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.