Property Segments
Segments
How many parts of one file DownloadFileAsync(string, string, SftpTransferOptions?, CancellationToken) fetches at once, each over its own SFTP session on the same
connection (default 1: one session). Each session is an SSH channel with its own flow-control window, and on OpenSSH its own
sftp-server process, so on a link with high latency several segments move more than one session can: one session carries at
most its 2 MiB window per round trip. It does not help where the bandwidth, or the server's single connection, is the limit.
Files smaller than 1 MiB per segment use fewer segments; the server may allow fewer sessions (sshd's MaxSessions, 10 by
default), and then fewer are used. Ignored with Resume (only a sequential download leaves a prefix to resume from)
and by DownloadAsync(string, Stream, SftpTransferOptions?, CancellationToken), which writes a stream in order. Each extra session opens the file by path, so a
file whose size or modification time has changed by then (replaced, or still being written) fails the download.
public int Segments { get; init; }