[ENet-discuss] Finding host IP

Lee Salzman lsalzman at telerama.com
Tue Aug 12 10:50:26 PDT 2003


The closest you can do at this point in time is a reverse lookup
with enet_address_get_host(), after using enet_address_set_host(...,
"127.0.0.1"). To get the interface IP you would need to 
check the IP list returned by gethostbyaddr(). I can add a function to
ENet to do this if you'd like.

Lee

On Tue, Aug 12, 2003 at 12:39:50AM -0400, James Turk wrote:
> Sorry if this has been asked before, I tried searching the list archives 
> but I may have missed it.  I was wondering, if there is a way in enet to 
> find the host IP, like on any given computer if there's a way I could 
> write a function using enet that would work like  char* localIP(); that 
> would just return the IP in IPv4 format.  Recieving the IP in the 
> internal uint32 format would work as well as I know how to convert that 
> back to a.b.c.d.  I've tried setting up a host on the same computer as a 
> client and connecting to the client as 127.0.0.1, thinking that perhaps 
> name resolution would find the real IP, but this only returns 127.0.0.1. 
>  If this isn't built into enet, if anybody else has used this 
> functionality before and could point me in the right direction to 
> writing my own outside of enet I'd appreciate the help. 
> 
>             -James Turk
> 


More information about the ENet-discuss mailing list