getsockname
getsockname retrieves the local IP address and port to which the specified socket is bound.
Syntax
int getsockname(
[in] SOCKET s,
[out] struct sockaddr *name,
[in, out] int *namelen
);
Parameters
[in] s
The socket descriptor.
[out] name
A pointer to a socket address structure that will be filled in by getsockname.
[in, out] namelen
A pointer to an integer that defines the size of the socket address structure indicated by name. Upon return, namelen shall contain the actual size in bytes of name.
Return Value
If the function succeeds, it returns 0 (zero). If the function fails, it returns SOCKET_ERROR. Call WSAGetLastError to retrieve a specific error code.
Requirements
| Minimum supported version | Header | Library |
|---|---|---|
|
wRTOS 1.0 SDK |
winsock2.h |
RttcpipApi.lib |