(Abhijit Bhadra) wrote:
> struct sockaddr_in *CBaseSocket::GetSocketName()
> {
> socklen_t iLen;
> cCriticalSocket.Lock();
>
> if (sSocket == INVALID_SOCKET)
> {
> cCriticalSocket.Unlock();
> return(NULL);
> };
> cCriticalSocket.Unlock();
>
> iLen = sizeof(struct sockaddr_in);
> if (!::getsockname(sSocket, (struct sockaddr *) &sTAddr, &iLen))
> return(&sTAddr);
>
> return(NULL);
> };
You shouldn't need that semi-colon on the end.
What platform is this being written for? WinSock has no socklen_t, and
POSIX has no INVALID_SOCKET. It looks like the code was ported from
WinSock to POSIX, and still contains artifacts of WinSock.
My guess is, somewhere your code has this line,
#define socklet_t int
This is causing your 'iLen' variable to actually be an int, instead of
socklen_t. First, change it to a typedef. If it was a typedef, the
compiler would have given you a much more accurate error message.
Then, either delete it, or conditionally do it only on Windows.
HTH.
--
Dave O'Hearn