Table of Contents

Method ShutdownSendAsync

Namespace
SshSharp
Assembly
SshSharp.dll

ShutdownSendAsync(CancellationToken)

Ends the writing side of Stream without closing the connection, as Shutdown(SocketShutdown) with Send does: the server is sent end-of-file (SSH_MSG_CHANNEL_EOF), so the remote program reads to the end of what the handler wrote, while the handler can still read what the program sends. For a protocol where the end of a request or a response is the end of the stream.

public Task ShutdownSendAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Cancels waiting to send.

Returns

Task

Remarks

Call it once the handler's writes have completed, not while one is in progress. Writes after it throw InvalidOperationException, and a second call does nothing. Disposing Stream (or returning from the handler) still closes the connection. OpenSSH's sshd passes the end-of-file on by shutting the remote program's socket down for writing; a server that does not may keep the remote program waiting until the connection closes.

Exceptions

ObjectDisposedException

Stream was disposed.