[ENet-discuss] problem creating enet host
Martin Zemblowski
martin at bigheadgames.co.uk
Tue Sep 18 07:37:07 PDT 2012
Hello!
I am using enet library in conjunction with gamespy. I use gamespy to
create socket, connect to lobby, select opponent and do the NAT
punch-through. In next step I close gamespy socket, initialize enet
library and try to create enet host with same port (in my case I pass ip
as empty string) and then start connection to other party. It works, but
not always. I am using three computers right now: pc vista, pc xp and
mac osx 10.7.4. On mac sometimes (not always) I cannot create enet host
(even if i try to create host with different ports, 100 retries), here's
the code:
retries = 101;
enet_address_set_host (&enet.gAddress, ip);
do {
enet.gAddress.port = port;
enet.gHost = enet_host_create (&enet.gAddress , 1 , 2, 0 ,0 );
if (enet.gHost == NULL)
{
printf ( "An error occurred while trying to create an ENet
host(%s:%d).\n",ip,port);
port++; // HACK
}
else
printf( "host created.\n");
} while (enet.gHost == NULL && (--retries > 0));
Any ideas?
Thank you!
Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubik.org/pipermail/enet-discuss/attachments/20120918/80767d3e/attachment.html>
More information about the ENet-discuss
mailing list