socket_object.RemoteEndPoint Property

Gets remote end point information for an active TCP connection.
...socket_object.RemoteEndPoint

Prerequisites

None

Parameters

None

Remarks

This property returns information about the opened end point for a TCP/IP connection. This information is especially useful after a listener accepts a connection. The returned object is of class IPEndPoint. The IPAddress and Port properties of the returned object contain information about the IP Address and Port of the remote client. If there is no active connection, the returned IPEndPoint object contains IPAddress "0.0.0.0" and Port 0.

Examples

Dim ep As New IPEndPoint("", 1234)   ' Listen on port 1234
Dim rem_ep As IPEndPoint
Dim
tl As New TcpListener(ep) ' Create listener object
Dim sock As Socket
tl.Start
sock = tl.AcceptSocket
rem_ep = sock.RemoteEndPoint
Console.Writeline("Remote IP = " & rem_ep.IPAddress)
Console.Writeline("Remote port = " & CStr(rem_ep.Port))

See Also

Networking Classes | tcplistener_object.AcceptSocket | IPEndPoint Class