Re: invalid conversion from `int*' to `socklen_t*'
From: Howard (alicebt_at_hotmail.com)
Date: 11/29/04
- Next message: Richard Herring: "Re: a basic question about STL"
- Previous message: Peter Seibel: "Re: C++ sucks for games"
- In reply to: Abhijit Bhadra: "invalid conversion from `int*' to `socklen_t*'"
- Next in thread: Stephan Br?nnimann: "Re: invalid conversion from `int*' to `socklen_t*'"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 29 Nov 2004 18:02:28 GMT
"Abhijit Bhadra" <abhijit.bhadra@ca.com> wrote in message
news:67c9c69e.0411290114.77756058@posting.google.com...
> Hi ,
> I am using gcc version 3.3.2. While compiling this code
> struct sockaddr_in *CBaseSocket::GetSocketName()
> {
> socklen_t iLen;
> cCriticalSocket.Lock();
> // Do we have a socket?
> 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);
> };
>
> I am getting this error while compiling :
>
> "invalid conversion from `int*' to `socklen_t*'"
>
> Can anyone help me to get rid of this error message ?
>
> Thanks,
> Abhijit
You shouldn't need it, but you might try casting &iLen as (socklen_t*), just
to see if it works.
(Are you getting any other errors? For example, are you getting an error
that "socklen_t" is not defined? That might also cause this error. Just
guessing, though.)
One other note: there's no reason for all those "struct" specifiers
scattered in your code. That looks like some old C code, not C++. Remove
them. The struct specifier is only needed for the original declaration of
the object, not when referring to objects of that type (or pointers to such
objects). So wherever you have "struct sockaddr", replace it with just
"sockaddr".
-Howard
- Next message: Richard Herring: "Re: a basic question about STL"
- Previous message: Peter Seibel: "Re: C++ sucks for games"
- In reply to: Abhijit Bhadra: "invalid conversion from `int*' to `socklen_t*'"
- Next in thread: Stephan Br?nnimann: "Re: invalid conversion from `int*' to `socklen_t*'"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|