From: Adam Majer Date: 2010-09-05T04:22:49+09:00 Subject: [ruby-core:32055] [Ruby 1.8-Bug#3787][Open] TCPSocket.new() fails on IPv6 connections for IPV4/IPv6 hosts Bug #3787: TCPSocket.new() fails on IPv6 connections for IPV4/IPv6 hosts http://redmine.ruby-lang.org/issues/show/3787 Author: Adam Majer Status: Open, Priority: Normal Category: core ruby -v: ruby 1.9.1p378 (2010-01-10 revision 26273) [x86_64-linux] $ host localhost localhost has address 127.0.0.1 localhost has IPv6 address ::1 ----- server setup is just listening to ::1 address, require 'socket' s = TCPServer.new( '::1', 1200 ) s.accept ---- then I try to connect to this with client socket, irb(main):001:0> require 'socket' => true irb(main):002:0> TCPSocket.new( 'localhost', 1200 ) Errno::ECONNREFUSED: Connection refused - connect(2) from (irb):2:in `initialize' from (irb):2:in `new' from (irb):2 from :0 irb(main):003:0> TCPSocket.new( '::1', 1200 ) => # Clearly, the 'localhost' should try to iterate through the addresses until it can connect, not fail. Python works correctly. telnet as well, $ telnet localhost 1200 Trying ::1... Connected to localhost. ---------------------------------------- http://redmine.ruby-lang.org