[ENet-discuss] How can I get the client port created in my client side (Soren Dreijer)
Siqi Shen
siqishen at gmail.com
Thu Jul 12 02:24:23 PDT 2012
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.
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
"http://msdn.microsoft.com/en-us/library/ms740148%28VS.85%29.aspx" that "If
a socket is opened, a
*setsockopt*<http://msdn.microsoft.com/en-us/library/ms740476(v=vs.85).aspx>
call
is made, and then a *sendto* call is made, Windows Sockets performs an
implicit *bind* function call."
so we can get the port through
"*getsockname*<http://msdn.microsoft.com/en-us/library/ms738543(v=vs.85).aspx>
" 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?
2012/7/11 <enet-discuss-request at cubik.org>
> Send ENet-discuss mailing list submissions to
> enet-discuss at cubik.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.cubik.org/mailman/listinfo/enet-discuss
> or, via email, send a message with subject or body 'help' to
> enet-discuss-request at cubik.org
>
> You can reach the person managing the list at
> enet-discuss-owner at cubik.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of ENet-discuss digest..."
>
>
> Today's Topics:
>
> 1. How can I get the client port created in my client side
> (Siqi Shen)
> 2. Re: How can I get the client port created in my client side
> (Soren Dreijer)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 11 Jul 2012 13:48:44 +0200
> From: Siqi Shen <siqishen at gmail.com>
> To: enet-discuss at cubik.org
> Subject: [ENet-discuss] How can I get the client port created in my
> client side
> Message-ID:
> <
> CAD6PKm0KJqwY-Rf5rSeBOL3ru7x7c2jEyxYvRCAExD1QrecMrQ at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi All,
>
> I am developing a small game using enet as network layer. My question is
> that how can I know the port I created in my client side to connect to
> remote host. I know that I can know the client's port in server's side when
> ENET_EVENT_TYPE_CONNECT receive; but I can not get the port when I use
> enet_host_create or enet_host_connect or ENET_EVENT_TYPE_CONNECT receive in
> client's side. Anyone know how to deal with this problem?
>
> Thanks and best regards,
> Siqi
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.cubik.org/pipermail/enet-discuss/attachments/20120711/c64afa88/attachment-0001.html
> >
>
> ------------------------------
>
> Message: 2
> Date: Wed, 11 Jul 2012 08:04:40 -0500
> From: "Soren Dreijer" <dreijer at echobit.net>
> To: "'Discussion of the ENet library'" <enet-discuss at cubik.org>
> Subject: Re: [ENet-discuss] How can I get the client port created in
> my client side
> Message-ID: <011301cd5f65$bc210a70$34631f50$@echobit.net>
> Content-Type: text/plain; charset="us-ascii"
>
> You're using UDP and you therefore don't have separate client-side ports
> when you "connect" to a server.
>
>
>
> The port you're using on the client is the one you specified in
> enet_host_create() when you initialized enet.
>
>
>
> From: enet-discuss-bounces at cubik.org [mailto:
> enet-discuss-bounces at cubik.org]
> On Behalf Of Siqi Shen
> Sent: Wednesday, July 11, 2012 6:49 AM
> To: enet-discuss at cubik.org
> Subject: [ENet-discuss] How can I get the client port created in my client
> side
>
>
>
> Hi All,
>
>
>
> I am developing a small game using enet as network layer. My question is
> that how can I know the port I created in my client side to connect to
> remote host. I know that I can know the client's port in server's side when
> ENET_EVENT_TYPE_CONNECT receive; but I can not get the port when I use
> enet_host_create or enet_host_connect or ENET_EVENT_TYPE_CONNECT receive in
> client's side. Anyone know how to deal with this problem?
>
>
>
> Thanks and best regards,
>
> Siqi
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.cubik.org/pipermail/enet-discuss/attachments/20120711/8830cb5d/attachment-0001.html
> >
>
> ------------------------------
>
> _______________________________________________
> ENet-discuss mailing list
> ENet-discuss at cubik.org
> http://lists.cubik.org/mailman/listinfo/enet-discuss
>
>
> End of ENet-discuss Digest, Vol 109, Issue 1
> ********************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubik.org/pipermail/enet-discuss/attachments/20120712/1c9754e4/attachment.html>
More information about the ENet-discuss
mailing list