Odd Net::FTP behavior

Here’s my (simple) code. This has worked fine in the past;
now even this simple example fails for me.

It gets as far as creating an empty file, then it hangs and
times out.

This is Ruby 1.8.4 on FC4, talking to another Linux box
(RH Enterprise I think).

Any ideas?

Hal

domain, user, password = “mydomain.com”, “myuser”, “mypass”
args = [domain]
args << user << password if user != nil
puts “Connecting…”
@ftp = Net::FTP.new(*args)
@rempath = “/var/www/html/whatever/”
puts “Change dir…”
@ftp.chdir(@rempath)

puts “Upload file…”
@ftp.puttextfile(“foobar”,“foobar-rem”) # Hangs here!
puts “Closing…”
@ftp.close
puts “Finished.”

On Fri, 11 Aug 2006 [email protected] wrote:

@ftp.chdir(@rempath)

puts “Upload file…”
@ftp.puttextfile(“foobar”,“foobar-rem”) # Hangs here!
puts “Closing…”
@ftp.close
puts “Finished.”

@ftp.passive = true ??

-a

[email protected] wrote:

On Fri, 11 Aug 2006 [email protected] wrote:

Any ideas?

@ftp.passive = true ??

Quite right, thank you.

Never needed that before. Wonder why I do now.
Not even sure what passive means.

Eventually I’ll move this app on to sftp anyway.

Thanks,
Hal

Someone may have tightened up the firewalls that previously were
allowing
your server to make TCP connections on ephemeral ports to your client
machine. Or you’re doing this from a different client than you’re used
to
and the topology is different.

On Fri, 11 Aug 2006 [email protected] wrote:

Never needed that before. Wonder why I do now.
Not even sure what passive means.

Eventually I’ll move this app on to sftp anyway.

Thanks,
Hal

it’s kinda confusing - i stumble on it from time to time - probably
better to
google it than listen to me. in any case the change would have been due
to a
change on the server - not your stuff. probably :wink:

-a

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs