session.setPort(port);
JSch jsch=new JSch(); Session session = jsch.getSession("akumar", "sindh"); session.setPort(22); session.setPassword("password123"); session.connect(); ChannelSftp channel = (ChannelSftp) session.openChannel("sftp"); channel.connect();
Session session = jsch.getSession(user, host); if (port != null) { session.setPort(port);
public Session getSession(String username, String host, int port) throws JSchException { if(username==null){ throw new JSchException("username must not be null."); } if(host==null){ throw new JSchException("host must not be null."); } Session s=new Session(this); s.setUserName(username); s.setHost(host); s.setPort(port); //pool.addElement(s); return s; }
session.setPort(port);
jschSession.setPort(uri.getPort());