pub unsafe fn getpeername(
sockfd: int,
addr: *mut sockaddr,
addrlen: *mut socklen_t,
) -> Result<int>
Expand description
Get the address of the peer connected to a socket.
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.