获取IP地址时出现套接字错误

时间:2017-11-24 12:12:49

标签: ruby sockets ip-address wpa

当我尝试这段代码时,

require "socket"

begin
    p Socket.ip_address_list
rescue Exception => e
    p "#{e.class} #{e.message}"
end

代码以输出

运行
"SocketError getnameinfo: Either the application has not called WSAStartup, or WSAStartup failed. "

我正在使用$ LOADED_FEATURES

运行代码
["enumerator.so", "thread.rb", "rational.so", "complex.so", "C:/Ruby23-x64/lib/ruby/2.3.0/x64-mingw32/socket.so", "C:/Ruby23-x64/lib/ruby/2.3.0/x64-mingw32/io/wait.so", "C:/Ruby23-x64/lib/ruby/2.3.0/socket.rb"]

我如何解决这个问题?请帮助我...

注意:我使用c ++运行代码调用ruby代码

1 个答案:

答案 0 :(得分:-1)

固定

原来已经输入了lws2_32.lib

相关问题