This function returns the current name for the specified socket descriptor. The name is in a format specific to the address family assigned to the socket (AF_INET, or AF_INET6 with BSD 4.4 when _SOCKADDR_LEN is defined). The bind() function, not the getsockname() function, makes the association of the name to the socket. Related Functions See also bind() and socket().