Function getsockname

Source
pub unsafe fn getsockname(
    sockfd: int,
    addr: *mut sockaddr,
    addrlen: *mut socklen_t,
) -> Result<int>
Expand description

Get the address that a socket is bound to.

Socket addresses have varying lengths depending on address family. Callers should pass a buffer of the appropriate size for the socket’s address family and indicate that buffer size in addrlen.

Updates the value at addrlen to reflect the number of bytes actually needed, which might be longer than the given addrlen if the given buffer is too short for the address, in which case the value written to addr is truncated to fit.