Advertisement
Guest User

Untitled

a guest
Jul 13th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. public static void main(String a[]) throws JSchException, InterruptedException
  2. {
  3. java.util.Properties config = new java.util.Properties();
  4. JSch jsch = new JSch();
  5. String user = "cli";
  6. String host = "135.104.217.114";
  7. String password = "cli";
  8. int port = 22;
  9. Session session = jsch.getSession(user,host,port);
  10. config.put("StrictHostKeyChecking", "no");
  11. session.setConfig(config);
  12. session.setPassword(password);
  13. session.connect();
  14. while(true)
  15. {
  16. if(session.isConnected())
  17. {
  18. System.out.println("session connected");
  19. }
  20. else
  21. {
  22. System.out.println("sesion not connected--------------");
  23. }
  24. Thread.sleep(1000);
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement