I have a problem using getsockname
function. I have this code:
struct sockaddr sa;
int sa_len;
sa_len = sizeof(sa);
if (getsockname(socketfd, &sa, &sa_len) != SOCKET_ERROR)
{
///
}
else
{
int error = WSAGetLastError();
//error here WSAEFAULT always
}
As you can see, i always have error when use getsockname function. Error - WSAEFAULT
. But why? structure and structure size are right, why this happens?
WSAEFAULT desc:
The name or the namelen parameter is not a valid part of the user address space, or the namelen parameter is too small.
p.s. Application is 64 bit
Thanks!