boost::corosio::tcp_socket::local_endpoint

Get the local endpoint of the socket.

Synopsis

endpoint
local_endpoint() const noexcept;

Description

Returns the local address and port to which the socket is bound. For a connected socket, this is the local side of the connection. The endpoint is cached when the connection is established.

Thread Safety

The cached endpoint value is set during connect/accept completion and cleared during close(). This function may be called concurrently with I/O operations, but must not be called concurrently with connect(), accept(), or close().

Return Value

The local endpoint, or a default endpoint (0.0.0.0:0) if the socket is not connected.

Created with MrDocs