Good time of day.
Ruby Code:
def hw_address(iface)
sock = Socket.new(Socket::AF_INET, Socket::SOCK_DGRAM,0)
buf = [iface,""].pack('a16h16')
sock.ioctl(SIOCGIFHWADDR, buf);
sock.close
return buf[18..24].to_etheraddr
end
puts hw_address('lo0')
What it do: gets mac-address of interface.
Works on Debian as expected. But on Mac OS X, im getting error: `ioctl': Operation not supported on socket (Errno::EOPNOTSUPP)
Is there anyway to fix/pass this error message & get working ioctl
on Sockets?