[ENet-discuss] How can I get the client port created in my client side (Soren Dreijer)

Soren Dreijer dreijer at echobit.com
Thu Jul 12 05:57:22 PDT 2012


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. 

 

*You* 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.

 

Maybe if you described what you're really trying to achieve, I can better
understand. :)

 

/ Soren 

 

From: enet-discuss-bounces at cubik.org [mailto:enet-discuss-bounces at cubik.org]
On Behalf Of Siqi Shen
Sent: Thursday, July 12, 2012 4:24 AM
To: enet-discuss at cubik.org
Subject: Re: [ENet-discuss] How can I get the client port created in my
client side (Soren Dreijer)

 

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
<http://msdn.microsoft.com/en-us/library/ms740476(v=vs.85).aspx> setsockopt
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 "
<http://msdn.microsoft.com/en-us/library/ms738543(v=vs.85).aspx> getsockname
" 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/312ce901/attachment-0001.html>


More information about the ENet-discuss mailing list