SSHSCP1: premature EOF

Frank Quosdorf frank.quosdorf@gmx.de
Fri, 17 Jan 2003 15:49:43 +0100 (MET)


Hi,

I'm using the copyToRemote(String localFile, String remoteFile, boolean
recursive) method like this:


for(int i = 0, n = localFilesUp.length;i < n;i++)
{
    File file = localFilesUp[i];
    if(file.isFile())
    {
        try
        {
            scp.copyToRemote(localFilesUp[i].getAbsolutePath(),
remotePathUp, false);
        }
        catch(IOException e)
        {
            System.out.println("could not upload file " +
localFilesUp[i].getAbsolutePath() + " : " + e + ". Resume next file.");
        }
    }
}


I get an java.io.EOFException exception when repeatedly invoking this method
without reassigning scp, since copyToRemote closes the SSHConsoleRemote
instance after copying a file.
I can't use copyToRemote(localFiles[], ...), since I could not resume in
case of errors.

After commenting out the remote.close() line in SSHSCP1.copyToRemote(...),
everything works fine. In addition I call the abort() method (after processing
all files) on the SSHSCP1 instance to close the remote object.

Wouldn't it be wise to change this permanently?

Regards, Frank

-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
NEU: Mit GMX ins Internet. Rund um die Uhr für 1 ct/ Min. surfen!