Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

net::SFTP write error with multiple packets

Status
Not open for further replies.

csgonan

MIS
May 2, 2007
118
US
I have net::xftp and net::SFTP installed on a solaris 8 workstation, connecting to a windows server running winscp.

I am able to uplaod a file but then receive an error message that it could not upload. I ssh into the server and see the file is there. The file size is exactly the total size of those 2 numbers in the SSH2_FXP_WRITE statements (8192 + 5821).

I'm using xFTP because these scripts are used to ftp and sftp and need to use the same ftp command.

Any ideas?

my %args = (user => $ftpuser, password => $ftppass, debug=>1);
$ftp = Net::xFTP->new(Net::SFTP,$ftpip, %args)

server: sftp: Sent message T:16 I:9
server: sftp: Sent message T:16 I:10
server: sftp: Sent message T:16 I:11
server: sftp: Sent SSH2_FXP_OPEN I:12 P:/opt/websites/
register.company.org/hccs/WC_file.dat
server: sftp: Sent message SSH2_FXP_WRITE I:13 O:0
server: sftp: In write loop, got 8192 offset 0
server: sftp: Sent message SSH2_FXP_WRITE I:14 O:8192
server: sftp: In write loop, got 5821 offset 8192
server: sftp: Sent message T:10 I:15
Uploading WC_file.dat to Server .......... Error: ./
uploadSSH_company2.pl could not upload WC_file.dat to Server.


 
Any chance of a bit more code? You could use 'or warn' or 'or die' on all your ftp commands, and if there's any more verbose information it should be output if any portion of the code fails.

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Thank you for responding.

I see with smaller files, or even this file using sftp at the command line, the file uploads fine. If you look at the section of the above debug output, it puts 8192 bytes then when it tries to put the remaining 5821 bytes, it fails. I read in some post that a user changed the COPY_SIZE from 8192 to 4063 and it worked but it ended up dealing with the ssh library. Do you know where that could be tried?

my %args = (user => $ftpuser, password => $ftppass, debug=>1);
$ftp = Net::xFTP->new(Net::SFTP,$ftpip, %args)

sub ftpul{
$ftp->cwd();
$ftp->cwd($ftppath);
$ftp->cwd($_[1]);
$ftp->binary;
print "Uploading $_[0] to Server .......... " if (!$silent);
$ftp->put($_[0]) or emailerr("Error: $0 could not upload $_[0] to Server.");
print "Done\n\n" if (!$silent);
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top