Home |
Function getsockname |
Function getsocknameReturns port number and IP address of the local host. int getsockname(SOCKET socket, struct sockaddr * addr, int * addrlen); ParameterssocketSocket returned by socket. addrReturns address of local host (port number and IP address are in network byte order). This parameter has type struct sockaddr * for historical reasons. Use type struct sockaddr_in * instead. addrlensize of structure pointed to by addr. return valueReturns 0 if successful, otherwise SOCKET_ERROR. If an error occurred, call xn_getlasterror and xn_geterror_string to return the error value. Section Error Codes further describes each error. Possible values for this function are:
This function extracts the IP address and port number of the local host of the socket and stores it in *addr. Upon entry, parameter addrlen should contain the size of the addr structure. getsockname sets addrlen to the size of the valid data stored in addr.
|