PowerTCP Telnet for .NET CF
RemoteEndPoint Property
See Also  Send comments on this topic.
Dart.Common Namespace > TcpBase Class : RemoteEndPoint Property




Gets the remote address and port of the server (never the proxy).

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property RemoteEndPoint As IPEndPoint
Visual Basic (Usage)Copy Code
Dim instance As TcpBase
Dim value As IPEndPoint
 
value = instance.RemoteEndPoint
C# 
public IPEndPoint RemoteEndPoint {get;}
Managed Extensions for C++ 
public: __property IPEndPoint* get_RemoteEndPoint();
C++/CLI 
public:
property IPEndPoint^ RemoteEndPoint {
   IPEndPoint^ get();
}

Property Value

The IPEndPoint of the remote host. Returns null if the State is ConnectionState.Closed.

Example

This example demonstrates using the component State to update the UI.
C#Copy Code
private void myComponent_StateChanged(object sender, EventArgs e)
{
    //Always raised when connection is established or closed (State property changes)
    switch (myComponent.State)
    {
        case Dart.Common.ConnectionState.Connected:
        case Dart.Common.ConnectionState.ConnectedAndSecure:
            //Update interface to indicate connection
            textDisplay.ReadOnly = false;
            textDisplay.BackColor = Color.WhiteSmoke;
            Text = (myComponent.State == Dart.Common.ConnectionState.Connected)
                ? APP_NAME + "  [Connected to " + myComponent.RemoteEndPoint.Address.ToString() + ":" +
                    myComponent.RemoteEndPoint.Port.ToString() + "]"
                : APP_NAME + "  [Securely Connected to " + myComponent.RemoteEndPoint.Address.ToString() + ":" +
                    myComponent.RemoteEndPoint.Port.ToString() + "]";
            break;

        case Dart.Common.ConnectionState.Closed:
            //Update interface to indicate no connection
            textDisplay.ReadOnly = true;
            textDisplay.BackColor = Color.Silver;
            this.Text = APP_NAME + "  [Not Connected]";
            break;
    }
}
C#Copy Code
Private Sub myComponent_StateChanged(ByVal sender As Object, ByVal e As EventArgs) Handles myComponent.StateChanged
	'Always raised when Connection is established or closed (State property changes)
	Select Case myComponent.State
		Case Dart.Common.ConnectionState.Connected, Dart.Common.ConnectionState.ConnectedAndSecure
			'Update interface to indicate connection
			textDisplay.ReadOnly = False
			textDisplay.BackColor = Color.WhiteSmoke
			If (myComponent.State = Dart.Common.ConnectionState.Connected) Then
				Text = APP_NAME & "  [Connected to " & myComponent.RemoteEndPoint.Address.ToString() _
					& ":" & myComponent.RemoteEndPoint.Port.ToString() & "]"
			Else
				Text = APP_NAME & "  [Securely Connected to " & myComponent.RemoteEndPoint.Address.ToString() _
					& ":" & myComponent.RemoteEndPoint.Port.ToString() & "]"
			End If

		Case Dart.Common.ConnectionState.Closed
			'Update interface to indicate no connection
			textDisplay.ReadOnly = True
			textDisplay.BackColor = Color.Silver
			Me.Text = APP_NAME & "  [Not Connected]"
	End Select
End Sub

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

Documentation Version 4.2
© 2010 Dart Communications. All Rights Reserved.