<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Just to chime in on this a bit:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I believe having the peer ID explicitly in the header also allows multiple connections between nodes.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>For instance, when I do NAT traversal, a peer attempts to connect to a remote peer both on the LAN address (e.g. 10.0.0.3) and via the public IP (e.g. 1.2.3.4). If the two peers happen to be on the same network, I’ve seen routers change the datagram header’s IP source for the public IP packet to the local IP. So, when the remote peer receives the two UDP packets, it looks like they’re coming from the same source (e.g. 10.0.0.2) even though they’re actually two independent connections.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Enet needs the peer ID in its header to properly figure out that it’s two separate enet channels because the IP/host pair isn’t enough.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Just my experience.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>/ Soren<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div style='border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt'><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> enet-discuss-bounces@cubik.org [mailto:enet-discuss-bounces@cubik.org] <b>On Behalf Of </b>Lee Salzman<br><b>Sent:</b> Thursday, May 24, 2012 6:53 AM<br><b>To:</b> Discussion of the ENet library<br><b>Subject:</b> Re: [ENet-discuss] Optimizing ENet Protocol ?<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>One way to handle all the mess reliably that I could conceive:<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Hash on IP/port, just a big linearly probed array of pointers to peers would be sufficient. If not found, then send a sort of ack back to the client, requesting a re-connect packet. Once the other side receives the ack, that side sends a re-connect packet containing the long-form session id. So once the other end gets this, it uses the IP and session id to locate the correct peer, and set it up on the new port.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>But that only solves some of the problem. You still have to figure out what to do about protocol compatibility across all users of ENet... Trickier problem. :)<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>On Thu, May 24, 2012 at 4:31 AM, Len Holgate <<a href="mailto:len.holgate@gmail.com" target="_blank">len.holgate@gmail.com</a>> wrote:<o:p></o:p></p><div><p class=MsoNormal style='margin-bottom:12.0pt'>> Does the UDP packet's header contain the port of the Router or the<br>> initial sender port ? I'd guess the later, as when you send some<o:p></o:p></p></div><p class=MsoNormal>The datagram can only contain the address and port of the sender. BUT the<br>sender, in the case of NAT routers, is the NAT and NOT the client machine<br>where your code is running.<o:p></o:p></p><div><p class=MsoNormal style='margin-bottom:12.0pt'><br>> Anyway, I'll do a loose bind then, ie: if there's no perfect IP /<br>> Port match, I'd do only a IP match, that should be ok in my case.<o:p></o:p></p></div><p class=MsoNormal>Which will work just fine if you only have one peer coming in from that<br>particular address...<br><br>Len<br><a href="http://www.serverframework.com" target="_blank">www.serverframework.com</a><o:p></o:p></p><div><div><p class=MsoNormal><br>_______________________________________________<br>ENet-discuss mailing list<br><a href="mailto:ENet-discuss@cubik.org" target="_blank">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><o:p></o:p></p></div></div></div><p class=MsoNormal><o:p> </o:p></p></div></div></div></body></html>