[ENet-discuss] problem creating enet host

Daniel Aquino mr.danielaquino at gmail.com
Tue Sep 18 08:16:57 PDT 2012


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 <
martin at bigheadgames.co.uk> 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
> ENet-discuss at cubik.org
> http://lists.cubik.org/mailman/listinfo/enet-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubik.org/pipermail/enet-discuss/attachments/20120918/5d9bc578/attachment.html>


More information about the ENet-discuss mailing list