R
Robert William Vesterman
I just wrote (in Ruby) a little tool to help with FTPing a bunch of
files. It turned out to be ridiculously slow.
Upon investigation, it turns out that the culprit is the following
line in the "sendport" define of the standard FTP library (i.e.
"require 'net/ftp'"):
af = (@sock.peeraddr)[0]
This line is executed once per file that I'm trying to transfer, and
consistently takes (on my machine) five seconds or so each time that
it is executed.
The purpose of this line is to determine whether the remote host is
IP4 or IP6.
Commenting out the line, and hardcoding the IP4 path (which is what my
test host is) makes the whole program work fast and well.
What is the problem with this line, that it takes five seconds?
I am using Ruby 1.8, by the way.
Thanks,
Bob Vesterman.
files. It turned out to be ridiculously slow.
Upon investigation, it turns out that the culprit is the following
line in the "sendport" define of the standard FTP library (i.e.
"require 'net/ftp'"):
af = (@sock.peeraddr)[0]
This line is executed once per file that I'm trying to transfer, and
consistently takes (on my machine) five seconds or so each time that
it is executed.
The purpose of this line is to determine whether the remote host is
IP4 or IP6.
Commenting out the line, and hardcoding the IP4 path (which is what my
test host is) makes the whole program work fast and well.
What is the problem with this line, that it takes five seconds?
I am using Ruby 1.8, by the way.
Thanks,
Bob Vesterman.