sshj icon indicating copy to clipboard operation
sshj copied to clipboard

Is SftpClient creates new session for each operation?

Open Vsevolod-Tsukanov opened this issue 6 months ago • 1 comments

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);

Vsevolod-Tsukanov avatar Jun 26 '25 12:06 Vsevolod-Tsukanov

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();

d31m07y1988 avatar Oct 07 '25 05:10 d31m07y1988