Re: type cast error
On Mar 1, 9:11 pm, Andre <sieg1...@yahoo.com> wrote:
[...]
Network.cpp:112: error: invalid conversion from \u2018int*\u2019 to \u201=
8socklen_t*\u2019
Network.cpp:112: error: initializing argument 6 of \u2018ssize_t recvfr=
om
(int, void*, size_t, int, sockaddr*, socklen_t*)\u2019
regarding the following piece of code
socklen_t sourceAddressLength = sizeof(struct sockaddr_in);
* messageToReceiveLength = recvfrom(localSocketFd,
messageToReceive,
* messageToReceiveLength,
0,
(struct sockaddr *)
&sourceAddress,
&sourceAddressLength);
I also tried "socklen_t sourceAddressLength =
static_cast<socklen_t> (sizeof(struct sockaddr_in));", but I
get the same errors.
I can't reproduce it on my maching, but a priori, from the
error message, you have a problem with the definition of
socklen_t (which is required by Posix to be an integer type with
at least 32 bits). My guess is that somewhere locally there is
a definition of socklen_t, to something different from what it
is defined as in the Posix header.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34