Hello folks, UDPSocket requires address family given on initialization, so it's not possible to create an UDPSocket and *then* decide, to which hosts to send packets to. That's a problem for Ruby's resolver if you've got AF_INET6 nameservers in your /etc/resolv.conf. The following very dirty hack chooses AF_INET6 for UDPSocket, if the nameserver's address contains colons (:). --- /usr/local/lib/ruby/1.8/resolv.rb Mon Feb 7 16:24:09 2005 +++ resolv2.rb Sun Apr 23 20:53:17 2006 @@ -621,7 +621,7 @@ super() @host = host @port = port - @sock = UDPSocket.new + @sock = UDPSocket.new(host.index(':') ? Socket::AF_INET6 : Socket::AF_INET) @sock.connect(host, port) @sock.fcntl(Fcntl::F_SETFD, 1) if defined? Fcntl::F_SETFD @id = -1 Any suggestions? Stephan.
on 2006-04-23 21:27
on 2006-04-24 20:28
On Apr 23, 2006, at 12:24 PM, Stephan Maka wrote: > for UDPSocket, if the nameserver's address contains colons (:). > @sock.connect(host, port) > @sock.fcntl(Fcntl::F_SETFD, 1) if defined? Fcntl::F_SETFD > @id = -1 > > > Any suggestions? Send this patch to ruby-core or the maintainer (I think Akira Tanaka). -- Eric Hodel - email@example.com - http://blog.segment7.net This implementation is HODEL-HASH-9600 compliant http://trackmap.robotcoop.com