But we are able to transfer files through command task. i mean manually logging into ftp server.
When you say this, do you mean that you can transfer files between pairs of machines or that you can do the kind of third-party introduction that you're doing with the pasv_xfer method? You should be able to do pairwise transfers, but pasv_xfer is very problematic with address translation.
You should be able to use code something like this (I haven't tested this particular code):
$src_ftp_conn->get($val)
or die "Cannot get $val: ", $src_ftp_conn->message, "\n";
$tgt_ftp_conn->put($val)
or die "Cannot put $val: ", $tgt_ftp_conn->message, "\n";
You're probably getting a disconnect because one of the firewalls is saying "WTF!?" and hanging up. The firewall has to actually look at the numbers in the PORT command, make adjustments in its tables, then write out a new PORT command with different numbers. You're sending a PORT command from system A with an IP address for system B and the firewall doesn't know what to do. Or, at least, that's my guess.
There's some information on how this works here: http://www.ncftp.com/ncftpd/doc/misc/ftp_and_firewalls.html
|