-1

When I try this code,

require "socket"

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

Code runs with output this

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

I'm running code with $ 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"]

How i can fix that? Please Help Me...

Note : I run the code with c++ calling the ruby code

Reckordp
  • 1
  • 1
  • 4
  • Issue has probably got nothing to do with ruby; it is with your WSAStartup. See: [this](https://answers.microsoft.com/en-us/windows/forum/windows_vista-networking/wsastartup0-failed-or-you-have-the-incorrect/8f87e808-3d2c-4d88-a200-727cb24a40a8?auth=1) and [this](https://superuser.com/questions/633550/wsastartup-failed-or-you-have-the-incorrect-version-of-winsock-installed). Maybe just try: `netsh winsock reset`? – Tom Lord Nov 24 '17 at 12:24
  • Here, if I run code with IRB no problem. but I run this code with C++ calling the ruby code. do i have to insert winsock.dll? – Reckordp Nov 24 '17 at 12:29

1 Answers1

-1

Fixed

It turned out to have entered lws2_32.lib

Reckordp
  • 1
  • 1
  • 4