Share via


Socket.LocalEndPoint Property

Gets the local endpoint that the current socket is using for communications.

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

Syntax

public EndPoint LocalEndPoint { get; }

Property Value

An EndPoint object specifying the local endpoint that the current socket is using for communications.

Remarks

The LocalEndPoint property gets an EndPoint object that contains the local IP address and port number to which the current socket is bound. You must cast this EndPoint object to an IPEndPoint object before retrieving any information. You can then call the IPEndPoint.Address method to retrieve the local IP address, and call the IPEndPoint.Port method to retrieve the local port number.

The LocalEndPoint property is usually set after you make a call to the Bind method. If you permit the system to assign your socket's local IP address and port number, the LocalEndPoint property is set after the first I/O operation. For connection-oriented protocols, the first I/O operation would be a call to the Connect or Accept method. For connectionless protocols, the first I/O operation would be any of the send or receive calls.

Version Information

Available in .NET Micro Framework version 2.0, 2.5

See Also

Reference

Socket Class
Socket Members
System.Net.Sockets Namespace