25 May 2013 22:51
LuaSocket: trouble getting system ip addresses
Thijs Schreijer <thijs <at> thijsschreijer.nl>
2013-05-25 20:51:30 GMT
2013-05-25 20:51:30 GMT
I'm having trouble getting the systems IP addresses.
On Windows this works;
socket.dns.toip(socket.dns.gethostname())
On Linux (raspberry pi, Ubuntu 10) it doesn't
Test code:
local socket = require("socket")
function one(name)
print('=========='..name..'===========')
local ip, v = socket.dns.toip(name)
print('name',v.name,ip)
print('alias')
for k,v in pairs(v.alias) do
print('',k,v)
end
print('address')
for k,v in pairs(v.ip) do
print('',k,v)
end
print('====================================')
end
one('localhost')
one(socket.dns.gethostname())
It delivers:
pi <at> raspberrypi ~ $ lua listaddr.lua
(Continue reading)
, even with a fairly quick calculation of Hamming weight using 14-bit lookup tables...
RSS Feed