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



I also had the same problem :
$ ./echoserver 1234
** (process:1528): WARNING **: Can't set reuse on tcp socket
Could not create server on port 1234

The patch of Stephane Rouleau did not help.

I resolved it by patching the code at 2 places :
- 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 ?
- secondly, the implementation of gnet_private_create_listen_socken() in
gnet-private.c doesn't work if HAVE_IPV6 is not defined but policy is
GIPV6_POLICY_IPV4_THEN_IPV6 (this case is not handled), so I changed the
policy setting in gnet_init() in gnet.c : on windows, if HAVE_IPV6 is
not defined then set policy to GIPV6_POLICY_IPV4_ONLY.

Patches are in attachment.
Can a gnet developper apply theses patches to the sources, please ?

David Ergo
Alterface s.a.




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