RemoteEndPoint Property

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Gets the remote endpoint.

Namespace:  System.Net.Sockets
Assembly:  System (in System.dll)

member RemoteEndPoint : EndPoint

Property Value

Type: System.Net..::..EndPoint
The EndPoint with which the Socket is communicating.

If you are using a connection-oriented protocol, the RemoteEndPoint property gets the EndPoint that contains the remote IP address and port number to which the Socket is connected. If you are using a connectionless protocol, RemoteEndPoint contains the default remote IP address and port number with which the Socket will communicate. You must cast this EndPoint to an IPEndPoint before retrieving any information. You can then call the IPEndPoint..::..Address method to retrieve the remote IPAddress, and the IPEndPoint..::..Port method to retrieve the remote port number.

The RemoteEndPoint is set after a call to either Accept or Connect. If you try to access this property earlier, RemoteEndPoint will throw a SocketException. If you receive a SocketException, use the SocketException..::..ErrorCode property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

Show: