|
getsockname |
Top Previous Next |
|
The getsockname function retrieves the locally-bound name of the specified socket, stores this address in the sockaddr structure pointed to by the localAddr argument, and stores the length of this address in the object pointed to by the addrLen argument. If the actual length of the address is greater than the length of the supplied sockaddr structure, the stored address will be truncated. If the socket has not been bound to a local name, the value stored in the object pointed to by address is unspecified.
Syntax
Parameters socket A descriptor identifying the socket to close.
localAddr Points to memory location where sockaddr structure will be stored.
addrLen Points to an object that on the input specifies the length of area reserved for the sockaddr structure in bytes and the actual size of the stored sockaddr structure on the output.
Return value Upon successful completion, getsockname returns 0; otherwise, -1 is returned and errno set to indicate the error. |