sshj
sshj copied to clipboard
Is SftpClient creates new session for each operation?
How much sessions and channels will be created for following code:
SSHClient ssh = new SSHClient();
//... connect
SftpCLient sftp = ssh.newSFTPClient();
sftp.ls("sftp/path/file.txt");
sftp.mkdir("path/to/new/dir");
RemoteFile f = sftp.getSFTPEngine().open("/home/sftp/file1");
InputStream is = f.new RemoteFileInputStream(0);
You can see source code:
.... public SFTPClient(SessionFactory sessionFactory) throws IOException { this.engine = new SFTPEngine(sessionFactory); .... public SFTPEngine(SessionFactory ssh, String pathSep) throws SSHException { session = ssh.startSession(); loggerFactory = session.getLoggerFactory();