Socket hang (was recursive call problem)

G

Greg Brondo

Ok..Here's the new code...might be a bug in net/ftp or the socket code. The
exact same code (logically) modified runs like a champ under PHP. I've
tested this Ruby code on 1.8.0 on both Solaris and Windows. Same problem.
It hangs on a socket read.....

---- trace error ----
call /usr/local/lib/ruby/1.8/net/ftp.rb:191 getline Net::FTP
line /usr/local/lib/ruby/1.8/net/ftp.rb:192 getline Net::FTP
c-call /usr/local/lib/ruby/1.8/net/ftp.rb:192 readline IO
------------------
CODE :
-----------------
require 'net/ftp'

set_trace_func proc { |event, file, line, id, binding, classname|
printf "%8s %s:%-2d %10s %8s\n", event, file, line, id, classname
}

def reDir(ftp, dir)
ftp.chdir(dir)
puts ftp.pwd()

ftp.list('.') do |entry|
puts caller.join("\n")
tmp = entry.split(/ +/)
newentry = tmp[8]
### result = ftp_site($con, "CHMOD 777 $newentry");
result = 1
puts "#{newentry} -- #{result}";
if entry =~ /^d/
reDir(ftp, newentry);
end
end
ftp.chdir('..')
end

ftpServer = 'ftp.blah.com'
ftpUser = 'blahuser'
ftpPass = 'blahpass'

ftp = Net::FTP.new(ftpServer, ftpUser, ftpPass)
reDir(ftp, '/var/www/html/mambo')
ftp.close()


Any help would be appreciated!!

thanks!
Greg Brondo
 
T

ts

G> ftp.list('.') do |entry|

ftp.list('.').each do |entry|

G> puts caller.join("\n")


Guy Decoux
 
G

Greg Brondo

Thanks! That worked. One more questions though....

Why is ftp.list so dog slow?

Thanks again! (This really is a great list)...

Greg B
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,744
Messages
2,569,480
Members
44,900
Latest member
Nell636132

Latest Threads

Top