CreateShellStream: what are implications of the arguments?

Apr 7, 2014 at 1:03 PM
Hi,

I am creating a shellstream so that I can send commands and get responses from an embedded device.

Everything seems to be OK, but I don't understand the meaning of the arguments in CreateShellStream(...).

Specifically:

1) Why would I want to give a "terminalName"? Where/how is the terminal name used?
2) columns, rows, width, height? Again, I don't see how these are useable-- I just want to programmatically send commands and get responses for parsing. Are these intended for somekind of textbox display? What should I set them to for just parsing output?
3) Buffersize-- presumably should be as big or bigger than longest output from device?

Thanks for you help, and thanks for this really nice project!
-AT.
Apr 7, 2014 at 1:46 PM
1) TerminalName tells the server what type of terminal you want, vt220/xterm/xterm-color...
2) those are necessary for the ssh protocoll to open a shell of your needs
3) buffersize is unused in SSH.NET, no idea why it is there

See http://www.openssh.com/txt/rfc4254.txt for details
6.2.  Requesting a Pseudo-Terminal

   A pseudo-terminal can be allocated for the session by sending the
   following message.

      byte      SSH_MSG_CHANNEL_REQUEST
      uint32    recipient channel
      string    "pty-req"
      boolean   want_reply
      string    TERM environment variable value (e.g., vt100)
      uint32    terminal width, characters (e.g., 80)
      uint32    terminal height, rows (e.g., 24)
      uint32    terminal width, pixels (e.g., 640)
      uint32    terminal height, pixels (e.g., 480)
      string    encoded terminal modes
Apr 7, 2014 at 2:14 PM
Thanks for the quick reply!

By experiment, I now see that if I use "dumb" as my terminalName, then the terminal escape codes get stripped out (eg, the codes that colorize output are stripped out). This is very useful !

I guess the best practice for the other items is simply to use the same settings as one uses in a terminal application to manually perform the interactions?

-AT.