Issue #11134 has been reported by d m.

----------------------------------------
Bug #11134: resolution of "localhost" in windows server 2012 (ipv6 over ipv4)
https://bugs.ruby-lang.org/issues/11134

* Author: d m
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: 
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
I've just installed ruby 2.2 on Windows Server 2012 and i'm seeing this strange behaviour:

The server:

~~~
require "socket"

server = TCPServer.new("::1", 2000)
loop do
  client = server.accept
  client.puts "Hello !"
  client.close
end
~~~

in this case, a tcp connection to that server (using "localhost") goes fine, e.g.

~~~
TCPSocket.new("localhost", 2000).close # => processed instantly
~~~

BUT if the server bind on 127.0.0.1 or 0.0.0.0 (instead of ::1) the previous request takes at least 1 second to be processed.

The same occurs in windows server 2008, but there it can be fixed inserting the line "127.0.0.1  localhost" into the hosts file while in windows server 2012 the delay persists.




-- 
https://bugs.ruby-lang.org/