lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed, Jan 15, 2014 at 01:38:20PM -0500, Sean Conner wrote:
> It was thus said that the Great Paul K once stated:
> > Hi All,
> > 
> > I've been using socket.dns.toip(socket.dns.gethostname()) to get the
> > IP address of the computer my application is running on, but came
> > across several situations when the hostname doesn't resolve. It's
> > possible to configure it manually, but I'd prefer to have a way to
> > enumerate all known IP addresses and pick those that match some
> > conditions I'm interested in (for example, first ip4 non-loopback
> > address).
> > 
> > Is something like this possible with luasocket? I've seen other socket
> > libraries using getifaddrs (not sure about Windows, but there is
> > sockets.addressfamily with similar functionality [1]), but don't see
> > any of these methods being used in luasocket.
> 
>   getifaddrs() is not a standard call (it exists on Linux, not at all on
> Solaris and I don't know about any other system).  Also, the
> sockets.addressfamily() call you mention doesn't do what you think it does
> (all it returns is if the socket is IPv4, IPv6, appletalk, etc).
> 

FWIW, Solaris 11 added getifaddrs.