More socket problems (ftp) with Ruby and OS X 10.3


(David Heinemeier Hansson) #1

It seems that the need to turn on "Socket.do_not_reverse_lookup = true"
in order to use WEBrick with OS X 10.3 isn’t the only socket issue.
What follows is a basic example of attempting to do a directory listing
on a public FTP. Note that the FTP connection itself was successfully
estabilished. It’s only when I attempt to ls it throws the following…

irb(main):001:0> require 'net/ftp’
irb(main):002:0> sunsite = Net::FTP.open(“sunsite.auc.dk”)
irb(main):003:0> sunsite.login
irb(main):004:0> sunsite.ls
SocketError: getnameinfo: nodename nor servname provided, or not known
from /usr/local/lib/ruby/1.8/net/ftp.rb:295:in addr' from /usr/local/lib/ruby/1.8/net/ftp.rb:295:inmakeport’
from /usr/local/lib/ruby/1.8/net/ftp.rb:329:in transfercmd' from /usr/local/lib/ruby/1.8/net/ftp.rb:421:inretrlines’
from /usr/local/lib/ruby/1.8/net/ftp.rb:419:in synchronize' from /usr/local/lib/ruby/1.8/net/ftp.rb:434:inretrlines’
from /usr/local/lib/ruby/1.8/net/ftp.rb:628:in `ls’
from (irb):4

…attempting the “Socket.do_not_reverse_lookup = true”-trick gives a
different exception:

irb(main):001:0> require 'net/ftp’
irb(main):002:0> require ‘socket’
irb(main):003:0> Socket.do_not_reverse_lookup = true
irb(main):004:0> sunsite = Net::FTP.open(“sunsite.auc.dk”)
irb(main):005:0> sunsite.login
irb(main):006:0> sunsite.ls
Errno::EPROTONOSUPPORT: Protocol not supported - socket(2)
from /usr/local/lib/ruby/1.8/net/ftp.rb:295:in initialize' from /usr/local/lib/ruby/1.8/net/ftp.rb:295:inopen’
from /usr/local/lib/ruby/1.8/net/ftp.rb:295:in makeport' from /usr/local/lib/ruby/1.8/net/ftp.rb:329:intransfercmd’
from /usr/local/lib/ruby/1.8/net/ftp.rb:421:in retrlines' from /usr/local/lib/ruby/1.8/net/ftp.rb:419:insynchronize’
from /usr/local/lib/ruby/1.8/net/ftp.rb:434:in retrlines' from /usr/local/lib/ruby/1.8/net/ftp.rb:628:inls’

Any known work-arounds for this? Is the socket issues being worked on
in general?

···


David Heinemeier Hansson,
http://www.basecamphq.com/ – Web-based Project Management
http://www.loudthinking.com/ – Broadcasting Brain