[ENet-discuss] Mixing server and client

Lee Salzman lsalzman1 at cox.net
Sat Apr 18 01:31:41 PDT 2009


The significance is that passing in an address causes the UDP socket to 
bind to a specific address. If you don't bind at least a port, you are 
both getting an ephemeral port assigned the socket, and you are getting 
whatever IP the OS decided to assign to the socket. Now, if you are 
having your servers connect to said public service to tell what their 
IP/port is, this really doesn't matter all that much. Though, many 
people like to be able to explicitly assign ports/IPs to their game 
servers - especially when they have multiple IPs on their host.

Lee

M. Rijks wrote:
> Thank you for your reactions, both. I should learn and catch the 
> subtle hints in the documentation. :)
>
> My intention is to make the 'server' connect to a public service 
> (running Enet) which passes the server's public IP and port around to 
> clients querying the same service for sessions.
>
> What made it slightly confusing for me is that for a client a NULL 
> address is specified when creating a host, while for the server one 
> specifies an IP (well, often just ENET_HOST_ANY) and a port. So 
> apparently you can leave those NULL as well?
>



More information about the ENet-discuss mailing list