摘要: A server typically has more than one interface, at least one private and one public.Since all the answers here deal with this simple scenario, a cleaner way is to ask Socket for the current ip_address_list() as in:require 'socket'def my_first_private_ipv4 Socket.ip_address_list.detect{|intf| 阅读全文
posted @ 2013-09-25 10:25 LaoQuans 阅读(585) 评论(0) 推荐(0)