Quantcast
Channel: sshnet Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1729

New Post: How can I enable the receipt of 8 bit characters from a SSH connection

$
0
0
Hi,

I have been most impressed with SSH.NET, with all the help here I was able to get my terminal emulator to make SSH connections in a short period of time. Well done.

My current issue I have not been able to yet solve. The server program outputs terminal control characters in the range 0x80 to 0xFF. I have tried setting terminal modes in the call to CreateShellStream and I have tried all of the Encoding values in the call to StreamReader constructor. In all cases some if not all of the characters 0x80-0xFF were translated.

Please see my code snippet below.

Regards,
Dave.
                    System.Collections.Generic.Dictionary<TerminalModes, uint> tm = new System.Collections.Generic.Dictionary<TerminalModes, uint>();
                    tm[TerminalModes.PARENB] = 0;
                    tm[TerminalModes.ISTRIP] = 0;
                    tm[TerminalModes.CS7] = 0;
                    tm[TerminalModes.CS8] = 1;

                    /* Start the monitor thread which will detect when remote end
                     * closes the connection and will invoke DisconnectEx on this
                     * connection thread */

                    DisconnectEvent += new DisconnectEventHandler(Disconnect);
                    monitorThread = new Thread(monitor);
                    monitorThread.Start();

                    strm = client.CreateShellStream(termType, (uint)tw.Columns, (uint)tw.Rows,
                                                    (uint)tw.ClientSizeEx.Width, (uint)tw.ClientSizeEx.Height, 1024, tm);

if ISNT

                    strm = client.CreateShellStream(termType, (uint)tw.Columns, (uint)tw.Rows,
                                                    (uint)tw.ClientSizeEx.Width, (uint)tw.ClientSizeEx.Height, 1024);

endif

                    //strmReader = new StreamReader(strm);
                    /* Tried these encodings:-
                     * ASCII - >= 0x80-0xFF translated to 0x3F.
                     * Default - 0x80-0x9F : Some set of special Unicode characters, 0xA0-0xFF : unchanged.
                     *           This is using the current Windows ANSI code page. Do I need something like
                     *           code page 8859-1 - Latin alphabet which doesn't seem to translate codes.
                     * Unicode - got a buffer of individual bytes instead of normal 0x61 0x00 etc for each char.
                     * UTF8 - I think this is default. >= 0x80 translated to 0xfffd
                     */ 
                    strmReader = new StreamReader(strm, Encoding.Default);
                    //strmWriter = new StreamWriter(strm);
                    strmWriter = new StreamWriter(strm, Encoding.Default);

Viewing all articles
Browse latest Browse all 1729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>