Closed
Description
The Wrìte(String)
and WriteLine(String)
methods in ShellStream currently do not write to the buffer, and do not flush the buffer before data is send to the server.
Consider the following example:
var abcBytes = Encoding.UTF8.GetBytes("abc");
var ghiBytes = Encoding.UTF8.GetBytes("ghi");
shellStream.Write(abcBytes, 0, abcBytes.Length); // writes to buffer, unless buffer is full
shellStream.Write("def");
shellStream.Write(ghiBytes, 0, ghiBytes.Length); // writes to buffer, unless buffer is full
shellStream.WriteLine("jkl");
shellStream.Flush();
Expected result:
All bytes are buffered, and - upon invoking Flush()
- the following text is sent to the server in a single SSH_MSG_CHANNEL_DATA message:
- abcdefghijkl\r
Actual result:
Tollowing fragments are sent in the order list, and each fragment is sent in a separate SSH_MSG_CHANNEL_DATA message:
- def
- jkl\r
- abcghi