Re: Error uploading file
Bernardo F Costa <[email protected]>
| Newsgroups | gmane.comp.java.sshtools.user |
|---|---|
| Message-ID | <[email protected]> |
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/ ------------------------------------------------------------------------- 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