when the file is bigger (>300kb)the file gets copied partially before truncating and returning an error messageI find the same thing when I scp_put (~6Mb file) from Windows to a remote linux server ... but no problem when I scp_put the same file from the same Windows machine to my local linux box.
I've therefore taken to blaming the server on the remote box, or the speed of the connection, but of course I don't really know what the problem is. Thankfully, if I keep trying long enough, the upload eventually succeeds. I've sometimes felt that it helps to unlink the truncated file from the remote server before re-attempting the scp_put.
You can perhaps get a better idea of the error, by doing:
if(!($ssh2 ->scp_put(${datafile},${dir}))) {
my @error = $ssh2->error();
die ("@error");
}
Can someone examine the server logs at the other end for any clue for you ? (In my case, I'm given access to the remote server as a favour, so am not keen to seek that sort of assistance.)
Or maybe even the server could be put into debug mode for you ?
Other than that, is uploading with sftp (again using Net::SSH2) an option for you ? I haven't yet tried that, but it's something I intend to try next time I strike trouble with scp_put.
Finally, which version of perl are you running, which version of Net::SSH2 do you have, and how did you install it ? Tomorrow, I could upload the latest version of Net::SSH2, built against the latest libssh2 library to the uwinnipeg ppm repository, if you like. Not sure that it will fix the problem however ... didn't for me.
Cheers,
Rob