• Post Reply Bookmark Topic Watch Topic
  • New Topic

SSH TimeOut not working

 
Aswin Gopal
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to check SFTP connection to remote server using enchanter jar. This is not a multi-threaded application. PFB sample code...




note - the batch.file contains only 1 statement. Please find below.
---
bye
---

But the above program is getting is stuck at times when the server is not responding. It goes into infinite hung state.

Is there some alternative ways to set timeout ?

 
Richard Tookey
Bartender
Posts: 1166
17
Java Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depending on which SSH client you are using it should be possible to use inbuilt SFTP methods rather than needing to invoke a command line though SSH. Which SSH client are you using and why?
 
Aswin Gopal
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using a jar called as enchanter. Enchanter is a small library that helps you script SSH sessions.

I am new this sort of thing. If there is some other ways to use inbuilt SFTP commands. Please also let me know.

The mentioned code works to check for SFTP connection but at times if the server is down then it goes into infinite hung state. I want to timeout before it does so.
 
Richard Tookey
Bartender
Posts: 1166
17
Java Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aswin Gopal wrote:I am using a jar called as enchanter. Enchanter is a small library that helps you script SSH sessions.


Rather than have to have an SSH/SFTP native client installed as well as a Java package I prefer a more direct and platform independent approach such as that provided by Java SSH clients such as JSSH from JCraft ( http://www.jcraft.com/jsch/ ).
 
Aswin Gopal
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Richard.

And yes I will check that too but for time being, with the above method that I followed, is there a way to make Timeout happen.
 
Richard Tookey
Bartender
Posts: 1166
17
Java Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suspect you will need to ask the author of Enchanter but the whole project does not seem very active (created on BitBucket 2013-04-26 last updated 2013-04-26) so don't hold your breath.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!