I implemented this using ENet but have not had a chance to finish testing it. The basic concept is simple so I expect it should work.
I did something a bit sketchy but should probably work. All you need to do is send a few packets to the destination IP. The content isn't important since all you're doing is establishing the connection with the NAT router. ENet has code to send packets that is specific to operating system (see win32.c). I call an internal library function one next layer above those routines. It implements a non operating system specific packet send. Another ENet mailing list member suggested 5 packets sent about 100 ms apart. He had no specific information that the count or timing was important. Alternately I believe you could also use ENet to connect to the destination address and ignore the errors on the first connection attempt. Enet will send packets trying to connect that will punch the hole for you. YMMV. On Mon, May 2, 2011 at 3:32 PM, Josh Klint <[email protected]> wrote: > Hi, > > > > A search for enet and NAT punch-through yields a lot of questions about > whether this is possible and discussion of how it might be done, but I have > never found an actual instance of working code, or anyone who claims to have > successfully implemented NAT punch-through with enet. > > I love the simplicity of enet, but without NAT punch-through support, I > don't see how it is useful for networked software. I’ll have to > (unfortunately) go with RakNet, which is huge, bloated, and comes with > licensing hang-ups I have to pass on to my customers. > > > > > > Best Regards, > > > > Josh Klint > > CEO > > Leadwerks Software > > > > _______________________________________________ > ENet-discuss mailing list > [email protected] > http://lists.cubik.org/mailman/listinfo/enet-discuss > > -- --- "The great thing about Object Oriented code is that it can make small, simple problems look like large, complex ones."
_______________________________________________ ENet-discuss mailing list [email protected] http://lists.cubik.org/mailman/listinfo/enet-discuss
