Is gamespy using tcp or udp ? If both your players try to connect at the same time then they should get through after a retry or two.
Although there is many types of nat's so it might not always work. On Tue, Sep 18, 2012 at 10:37 AM, Martin Zemblowski < [email protected]> wrote: > 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 > > > _______________________________________________ > ENet-discuss mailing list > [email protected] > http://lists.cubik.org/mailman/listinfo/enet-discuss > >
_______________________________________________ ENet-discuss mailing list [email protected] http://lists.cubik.org/mailman/listinfo/enet-discuss
