Error uploading file (solved)
Mari Carmen Garcia Mateos <[email protected]>
| Newsgroups | gmane.comp.java.sshtools.user |
|---|---|
| Message-ID | <[email protected]> |
Hi, all! The solution has been to modify the attribute BLOCKSIZE of the class SftpClient. Its previous value was 65535. It works with 32768 and even they have recommended to me to lower it 1536. I ignore if the size is a little a standard for the sftp servers, but it would be a good idea that was parametrizable in a future revision/distribution. Thank for your help and a greeting. ----- Mensaje original ---- De: Bernardo F Costa <[email protected]> Para: Mari Carmen Garcia Mateos <[email protected]>; [email protected] Enviado: jueves, 12 de abril, 2007 18:13:40 Asunto: Re: [Sshtools-users] Error uploading file I've never worked with sftp on sshtools, but maybe there is a bug in this area. Consider visiting this URL: http://capivara.sourceforge.net/?SSHTools You may test if such offered patches can make your program work. --- Mari Carmen Garcia Mateos <[email protected]> escreveu: > Hi! > > Trying to do a sftp upload to a server I got the > following error (connection and download work): > > INFO: The remote computer disconnected: Protocol > error: packet too long: 65580 > > The file is 100kb and is the same file I have > downloaded before from the same server. > > I'm using the following java code (very similar to > the example in the sshtools distribution): > > ConfigurationLoader.initialize(false); > > BufferedReader reader = new BufferedReader(new > InputStreamReader(System.in)); > System.out.print("Connect to host? "); > String hostname = reader.readLine(); > > // Make a client connection > SshClient ssh = new SshClient(); > // Connect to the host > ssh.connect(hostname); > > // Get the users name > System.out.print("Username? "); > String username = reader.readLine(); > pk.setUsername(username); > > PublicKeyAuthenticationClient pk = new > PublicKeyAuthenticationClient(); > // Get the private key file > System.out.print("Path to private key file? "); > String filename = reader.readLine(); > > // Open up the private key file > SshPrivateKeyFile file = > SshPrivateKeyFile.parse(new File(filename)); > // If the private key is passphrase protected > then ask for the passphrase > String passphrase = null; > if (file.isPassphraseProtected()) { > System.out.print("Enter passphrase? "); > passphrase = reader.readLine(); > } > // Get the key > SshPrivateKey key = > file.toPrivateKey(passphrase); > pk.setKey(key); > > // Try the authentication > int result = ssh.authenticate(pk); > // Evaluate the result > if (result == > AuthenticationProtocolState.COMPLETE) { > // The connection is authenticated we can > now do some real work! > SftpClient sftpclient = > ssh.openSftpClient(); > > System.out.print("Fichero local? "); > String ficherolocal = reader.readLine(); > > System.out.print("Fichero remoto? "); > String ficheroremoto = reader.readLine(); > > sftpclient.put(ficherolocal,ficheroremoto); > > sftpclient.quit(); > ssh.disconnect(); > > > > ____________________________________________________________________________________ > LLama Gratis a cualquier PC del Mundo. > Llamadas a fijos y móviles desde 1 céntimo por > minuto. > http://es.voice.yahoo.com> ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get > the chance to share your > opinions on IT & business topics through brief > surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV> _______________________________________________ > Sshtools-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/sshtools-users > __________________________________________________ Fale com seus amigos de graça com o novo Yahoo! Messenger http://br.messenger.yahoo.com/ ____________________________________________________________________________________ LLama Gratis a cualquier PC del Mundo. Llamadas a fijos y móviles desde 1 céntimo por minuto. http://es.voice.yahoo.com ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Sshtools-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/sshtools-users