<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;}
@font-face
{font-family:"Segoe UI";
panose-1:2 11 5 2 4 2 4 2 2 3;}
/* 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.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;}
@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'>I don’t follow. Enet is only using a single port and multiplexes all connections through that single port. That is, it doesn’t matter whether you’re communicating with one or ten remote hosts; all traffic will go through that one port that Enet is bound to. <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'>*<b>You</b>* are in charge of choosing the port when you set up Enet (i.e. call enet_host_create), so I’m a little confused what the problem is. If you create 20 Enet instances in 20 different processes, then they’d all have different ports that you’ve chosen and thus know.<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'>Maybe if you described what you’re really trying to achieve, I can better understand. :)<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>Siqi Shen<br><b>Sent:</b> Thursday, July 12, 2012 4:24 AM<br><b>To:</b> enet-discuss@cubik.org<br><b>Subject:</b> Re: [ENet-discuss] How can I get the client port created in my client side (Soren Dreijer)<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Thanks for your reply. Setting port in enet_host_create is not flexible enough, as I may create more than 20 processes/threads. I think that once a udp diagram has been setup ( sendto() function has been called), the udp port in the client side is determine and it will be consistent across the whole application if we don't change the port manually. <o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>As I am using Win7 64bit. I use "netstat -an -p udp -o" to get the udp port and process id mapping and find that the UDP port I created in my process through enet is consistent. And as described in MSDN <o:p></o:p></p></div><div><p class=MsoNormal>"<a href="http://msdn.microsoft.com/en-us/library/ms740148%28VS.85%29.aspx">http://msdn.microsoft.com/en-us/library/ms740148%28VS.85%29.aspx</a>" that "<span style='font-size:10.0pt;font-family:"Segoe UI","sans-serif"'>If a socket is opened, a </span><a href="http://msdn.microsoft.com/en-us/library/ms740476(v=vs.85).aspx"><strong><span style='font-size:10.0pt;font-family:"Segoe UI","sans-serif";color:#960BB4;text-decoration:none'>setsockopt</span></strong></a><span style='font-size:10.0pt;font-family:"Segoe UI","sans-serif"'> call is made, and then a <strong><span style='font-family:"Segoe UI","sans-serif"'>sendto</span></strong> call is made, Windows Sockets performs an implicit <strong><span style='font-family:"Segoe UI","sans-serif"'>bind</span></strong> function call.</span>"<o:p></o:p></p></div><div><p class=MsoNormal>so we can get the port through "<a href="http://msdn.microsoft.com/en-us/library/ms738543(v=vs.85).aspx"><strong><span style='font-size:10.0pt;font-family:"Segoe UI","sans-serif";color:#960BB4;text-decoration:none'>getsockname</span></strong></a><span style='font-size:10.0pt;font-family:"Segoe UI","sans-serif"'> </span>" function. But I can not get the port in enet (I want to use the port number for debugging). Do you have a better solution besides setting port manually?<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>2012/7/11 <<a href="mailto:enet-discuss-request@cubik.org" target="_blank">enet-discuss-request@cubik.org</a>><o:p></o:p></p><p class=MsoNormal>Send ENet-discuss mailing list submissions to<br> <a href="mailto:enet-discuss@cubik.org">enet-discuss@cubik.org</a><br><br>To subscribe or unsubscribe via the World Wide Web, visit<br> <a href="http://lists.cubik.org/mailman/listinfo/enet-discuss" target="_blank">http://lists.cubik.org/mailman/listinfo/enet-discuss</a><br>or, via email, send a message with subject or body 'help' to<br> <a href="mailto:enet-discuss-request@cubik.org">enet-discuss-request@cubik.org</a><br><br>You can reach the person managing the list at<br> <a href="mailto:enet-discuss-owner@cubik.org">enet-discuss-owner@cubik.org</a><br><br>When replying, please edit your Subject line so it is more specific<br>than "Re: Contents of ENet-discuss digest..."<br><br><br>Today's Topics:<br><br> 1. How can I get the client port created in my client side<br> (Siqi Shen)<br> 2. Re: How can I get the client port created in my client side<br> (Soren Dreijer)<br><br><br>----------------------------------------------------------------------<br><br>Message: 1<br>Date: Wed, 11 Jul 2012 13:48:44 +0200<br>From: Siqi Shen <<a href="mailto:siqishen@gmail.com">siqishen@gmail.com</a>><br>To: <a href="mailto:enet-discuss@cubik.org">enet-discuss@cubik.org</a><br>Subject: [ENet-discuss] How can I get the client port created in my<br> client side<br>Message-ID:<br> <<a href="mailto:CAD6PKm0KJqwY-Rf5rSeBOL3ru7x7c2jEyxYvRCAExD1QrecMrQ@mail.gmail.com">CAD6PKm0KJqwY-Rf5rSeBOL3ru7x7c2jEyxYvRCAExD1QrecMrQ@mail.gmail.com</a>><br>Content-Type: text/plain; charset="iso-8859-1"<br><br>Hi All,<br><br>I am developing a small game using enet as network layer. My question is<br>that how can I know the port I created in my client side to connect to<br>remote host. I know that I can know the client's port in server's side when<br>ENET_EVENT_TYPE_CONNECT receive; but I can not get the port when I use<br>enet_host_create or enet_host_connect or ENET_EVENT_TYPE_CONNECT receive in<br>client's side. Anyone know how to deal with this problem?<br><br>Thanks and best regards,<br>Siqi<br>-------------- next part --------------<br>An HTML attachment was scrubbed...<br>URL: <<a href="http://lists.cubik.org/pipermail/enet-discuss/attachments/20120711/c64afa88/attachment-0001.html" target="_blank">http://lists.cubik.org/pipermail/enet-discuss/attachments/20120711/c64afa88/attachment-0001.html</a>><br><br>------------------------------<br><br>Message: 2<br>Date: Wed, 11 Jul 2012 08:04:40 -0500<br>From: "Soren Dreijer" <<a href="mailto:dreijer@echobit.net">dreijer@echobit.net</a>><br>To: "'Discussion of the ENet library'" <<a href="mailto:enet-discuss@cubik.org">enet-discuss@cubik.org</a>><br>Subject: Re: [ENet-discuss] How can I get the client port created in<br> my client side<br>Message-ID: <011301cd5f65$bc210a70$34631f50$@<a href="http://echobit.net" target="_blank">echobit.net</a>><br>Content-Type: text/plain; charset="us-ascii"<br><br>You're using UDP and you therefore don't have separate client-side ports<br>when you "connect" to a server.<br><br><br><br>The port you're using on the client is the one you specified in<br>enet_host_create() when you initialized enet.<br><br><br><br>From: <a href="mailto:enet-discuss-bounces@cubik.org">enet-discuss-bounces@cubik.org</a> [mailto:<a href="mailto:enet-discuss-bounces@cubik.org">enet-discuss-bounces@cubik.org</a>]<br>On Behalf Of Siqi Shen<br>Sent: Wednesday, July 11, 2012 6:49 AM<br>To: <a href="mailto:enet-discuss@cubik.org">enet-discuss@cubik.org</a><br>Subject: [ENet-discuss] How can I get the client port created in my client<br>side<br><br><br><br>Hi All,<br><br><br><br>I am developing a small game using enet as network layer. My question is<br>that how can I know the port I created in my client side to connect to<br>remote host. I know that I can know the client's port in server's side when<br>ENET_EVENT_TYPE_CONNECT receive; but I can not get the port when I use<br>enet_host_create or enet_host_connect or ENET_EVENT_TYPE_CONNECT receive in<br>client's side. Anyone know how to deal with this problem?<br><br><br><br>Thanks and best regards,<br><br>Siqi<br><br>-------------- next part --------------<br>An HTML attachment was scrubbed...<br>URL: <<a href="http://lists.cubik.org/pipermail/enet-discuss/attachments/20120711/8830cb5d/attachment-0001.html" target="_blank">http://lists.cubik.org/pipermail/enet-discuss/attachments/20120711/8830cb5d/attachment-0001.html</a>><br><br>------------------------------<br><br>_______________________________________________<br>ENet-discuss mailing list<br><a href="mailto:ENet-discuss@cubik.org">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><br><br><br>End of ENet-discuss Digest, Vol 109, Issue 1<br>********************************************<o:p></o:p></p></div><p class=MsoNormal><o:p> </o:p></p></div></div></div></body></html>