【发布时间】:2018-05-08 10:59:01
【问题描述】:
当我尝试这段代码时,
require "socket"
begin
p Socket.ip_address_list
rescue Exception => e
p "#{e.class} #{e.message}"
end
代码运行并输出 this
"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 代码运行代码
【问题讨论】:
-
这里,如果我用 IRB 运行代码没问题。但我用 C++ 调用 ruby 代码运行这段代码。我必须插入winsock.dll吗?
标签: ruby sockets ip-address wpa