[ENet-discuss] problem creating enet host

Daniel Aquino mr.danielaquino at gmail.com
Tue Sep 18 08:40:26 PDT 2012


Both hosts should try to send to one another at the same time from/to
predefined ports.

https://en.wikipedia.org/wiki/UDP_hole_punching




On Tue, Sep 18, 2012 at 11:24 AM, Martin Zemblowski <
martin at bigheadgames.co.uk> wrote:

>  gamespy transport service is using udp.
> right now one of the player creates socket and just listens to it, another
> on is actively trying to connect to other party, but fails at create_host
> for some reasons. I am creating host in the same way on both machines.
>
> I am testing connectivity on the same machines constantly, so I dont see
> any reason why it should work for 3 times in a row and then wouldnt... and
> it's a bit weird moment - creating host, i would expect it to fail when
> actually trying to connect
> :(
>
>
>
> On 18/09/2012 16:16, Daniel Aquino wrote:
>
> 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
>>
>>
>
>
> _______________________________________________
> ENet-discuss mailing listENet-discuss at cubik.orghttp://lists.cubik.org/mailman/listinfo/enet-discuss
>
>
>
> _______________________________________________
> 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/bd1d26ec/attachment-0001.html>


More information about the ENet-discuss mailing list