Problem with Net::Ftp

Hi,

I’ve just been trying out the Net::Ftp mudule on a Linux system (Caldera
OpenDesktop 3.1). I’m using the following example with Ruby 1.6.8

#!/usr/bin/env ruby
require ‘net/ftp’

ftp = Net::FTP.new(‘ftp.netlab.co.jp’)
ftp.login
files = ftp.chdir(‘pub/lang/ruby/contrib’)
files = ftp.list(‘n*’)
ftp.getbinaryfile(‘nif.rb-0.91.gz’, ‘nif.gz’, 1024)
ftp.close

I’m getting the following error:

/usr/local/lib/ruby/1.6/net/ftp.rb:57:in open': getaddrinfo: Name or service not known (SocketError) from /usr/local/lib/ruby/1.6/net/ftp.rb:57:inopen_socket’
from /usr/local/lib/ruby/1.6/net/ftp.rb:67:in connect' from /usr/local/lib/ruby/1.6/net/ftp.rb:67:inmon_synchronize’
from /usr/local/lib/ruby/1.6/net/ftp.rb:67:in connect' from /usr/local/lib/ruby/1.6/net/ftp.rb:45:ininitialize’
from ./tst_ftp.rb:5:in `new’
from ./tst_ftp.rb:5

This is a completely new installation of Ruby.

Thanks for any tips,

Martin.

wrong hostname :-

[loser@irc loser]$ irb
irb(main):001:0> require ‘net/ftp’
true
irb(main):002:0> ftp=Net::FTP.new ‘ftp.netlab.co.jp’
SocketError: getaddrinfo: Name or service not known
from /usr/local/lib/ruby/1.6/net/ftp.rb:57:in open' from /usr/local/lib/ruby/1.6/net/ftp.rb:57:in open_socket’
from /usr/local/lib/ruby/1.6/net/ftp.rb:67:in connect' from /usr/local/lib/ruby/1.6/net/ftp.rb:67:in mon_synchronize’
from /usr/local/lib/ruby/1.6/net/ftp.rb:67:in connect' from /usr/local/lib/ruby/1.6/net/ftp.rb:45:in initialize’
from (irb):2:in `new’
from (irb):2
irb(main):003:0> exit
[loser@irc loser]$ ping ftp.netlab.co.jp
ping: unknown host ftp.netlab.co.jp
[loser@irc loser]$ ping ftp.netlab.jp
PING parasect.netlab.jp (210.251.121.9) from 151.100.41.12 : 56(84)
bytes of data.

···

On Fri, 10 Jan 2003 10:23:23 +0100, collinsm@surfeu.de wrote:

Hi,

I’ve just been trying out the Net::Ftp mudule on a Linux system (Caldera
OpenDesktop 3.1). I’m using the following example with Ruby 1.6.8

#!/usr/bin/env ruby
require ‘net/ftp’

ftp = Net::FTP.new(‘ftp.netlab.co.jp’)
ftp.login
files = ftp.chdir(‘pub/lang/ruby/contrib’)
files = ftp.list(‘n*’)
ftp.getbinaryfile(‘nif.rb-0.91.gz’, ‘nif.gz’, 1024)
ftp.close

I’m getting the following error:

/usr/local/lib/ruby/1.6/net/ftp.rb:57:in open': getaddrinfo: Name or service not known (SocketError) from /usr/local/lib/ruby/1.6/net/ftp.rb:57:in open_socket’
from /usr/local/lib/ruby/1.6/net/ftp.rb:67:in connect' from /usr/local/lib/ruby/1.6/net/ftp.rb:67:in mon_synchronize’
from /usr/local/lib/ruby/1.6/net/ftp.rb:67:in connect' from /usr/local/lib/ruby/1.6/net/ftp.rb:45:in initialize’
from ./tst_ftp.rb:5:in `new’
from ./tst_ftp.rb:5

I've just been trying out the Net::Ftp mudule on a Linux system (Caldera
OpenDesktop 3.1). I'm using the following example with Ruby 1.6.8

...

ftp = Net::FTP.new('ftp.netlab.co.jp')

...

I'm getting the following error:

/usr/local/lib/ruby/1.6/net/ftp.rb:57:in `open': getaddrinfo: Name or
service not known

I guess that's because the name does not exist in the DNS:

$ nslookup ftp.netlab.co.jp

*** can't find ftp.netlab.co.jp: Non-existent host/domain

···

On Sun, Jan 12, 2003 at 05:44:57AM +0900, collinsm@surfeu.de wrote: