Is gamespy using tcp or udp ?<br><br>If both your players try to connect at the same time then they should get through after a retry or two.<br><br>Although there is many types of nat's so it might not always work.<br>
<br><br><br><div class="gmail_quote">On Tue, Sep 18, 2012 at 10:37 AM, Martin Zemblowski <span dir="ltr"><<a href="mailto:martin@bigheadgames.co.uk" target="_blank">martin@bigheadgames.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">
<div bgcolor="#FFFFFF" text="#000000">
<div style="font-family:-moz-fixed;font-size:14px" lang="x-western">Hello!
<br>
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:
<br>
<br>
retries = 101;
<br>
enet_address_set_host (&enet.gAddress, ip);
<br>
do {
<br>
enet.gAddress.port = port;
<br>
enet.gHost = enet_host_create (&enet.gAddress , 1 , 2, 0
,0 );
<br>
<br>
if (enet.gHost == NULL)
<br>
{
<br>
printf ( "An error occurred while trying to create an ENet
host(%s:%d).\n",ip,port);
<br>
port++; // HACK
<br>
}
<br>
else
<br>
printf( "host created.\n");
<br>
} while (enet.gHost == NULL && (--retries > 0));
<br>
<br>
Any ideas?
<br>
Thank you!
<br>
Martin
<br>
<br>
</div>
</div>
</div></div><br>_______________________________________________<br>
ENet-discuss mailing list<br>
<a href="mailto:ENet-discuss@cubik.org">ENet-discuss@cubik.org</a><br>
<a href="http://lists.cubik.org/mailman/listinfo/enet-discuss" target="_blank">http://lists.cubik.org/mailman/listinfo/enet-discuss</a><br>
<br></blockquote></div><br>