在输入中使用IRB时,收到错误:
IPSocket.getaddress("localhost")
错误:
NameError: uninitialized constant IPSocket
答案 0 :(得分:2)
在使用该课程前添加top:
require 'socket'
请参阅此socket/ipsocket.c
。
示例: -
2.1.0 :022 > require 'socket'
=> true
2.1.0 :023 > IPSocket.getaddress("localhost")
=> "::1"
2.1.0 :024 >