Re: [gnet] gnet 2.0.5 on windows with mingw/msys



David Ergo wrote:

- firstly, SOCKET is defined as an unsigned int under MINGW, so the test
"if (sockfd < 0)", at line 947 of tcp.c, is never true, I replaced it by
"if ((int)sockfd < 0)" (in my case sockfd was -1)
 Maybe more corrections of the same type should be done or maybe the
SOCKET type should be corrected in MINGW ?
No, this is the winsock implementation, provided by Microsoft. You could solve it on MinGW, but this code would still fail in all other Win32 compilers.
The correct way for checking if a socket is valid would be:
if (sockfd == -1) /* this works with an unsigned sockfd, but issues a warning */

Do the BSD sockets implementations never return sockets bigger than INT_MAX ? Isn't a socket with a value of -2 valid?


Daniel K. O.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]