lua-users home
lua-l archive

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


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.

Paul.

[1] http://msdn.microsoft.com/en-us/library/system.net.sockets.addressfamily(v=vs.110).aspx