Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ShellStream: Write(String) and WriteLine(String) do not use write buffer #301

Closed
drieseng opened this issue Sep 17, 2017 · 2 comments · Fixed by #1322
Closed

ShellStream: Write(String) and WriteLine(String) do not use write buffer #301

drieseng opened this issue Sep 17, 2017 · 2 comments · Fixed by #1322
Milestone

Comments

@drieseng
Copy link
Member

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
@IgorMilavec
Copy link
Collaborator

I have created a discussion #926 for all ShellStream related issues.

@WojciechNagorski
Copy link
Collaborator

This issue has been fixed in the 2024.0.0 version.

@WojciechNagorski WojciechNagorski added this to the 2024.0.0 milestone Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants