folly::netops::getsockname

Retrieves the local address bound to a socket.

Synopsis

Declared in <folly/net/NetOps.h>

int
getsockname(
    NetworkSocket s,
    sockaddr* name,
    socklen_t* namelen);

Return Value

0 on success, or -1 on error.

Parameters

NameDescription
sThe socket to query.
nameBuffer that receives the local address.
namelenIn/out length of the address buffer.