0 votes
by (180 points)
edited by

In our Telnet connection we receive these bytes after some time idle. We supose that are sent from the server to keep the session alive, but somehow they end up showing at the VirtualTerminal screen (as ÿö) and interfering with our operations.

Using the sample application, we have the following screenshots:

Is there any way to prevent this from happening?

2 Answers

0 votes
by (72.7k points)
selected by
 
Best answer

Thank you for the Verbose log. I have replied to your email with detailed description of the issue and 3 possible ways to solve it. I post my findings here for other visitors.

The issue is caused by the server which uses Telnet over SSH. It is not a standard way to communicate with an SSH server. After establishing SSH connection the server starts using Telnet protocol, which emits various Telnet related data. However, there is no Telnet interpreter on the client side, which results to displaying the "Telnet binary" data on the screen.

Possible solutions:

  1. Configure your server to not use Telnet (over SSH) if possible.
  2. Bind TerminalControl to Telnet and use Ssh as data transport layer.
  3. Inject into SSH data transport layer and modify traffic as you want (make your own Telnet interpreter).

Sample code for case 2:

var ssh = new Ssh();
ssh.Connect("test.rebex.net", 22);
ssh.Login("demo", "password");

var telnet = new Telnet("-communicates-over-ssh-");
telnet.SetSocketFactory(new SshSocketFactory(ssh));

terminal.Bind(telnet);

Sample code for case 3:

var ssh = new Ssh();
ssh.Connect("test.rebex.net", 22);
ssh.Login("demo", "password");

terminal.Bind(new SshWrapper(ssh));

The codes uses custom classes: SshSocketFactory and SshWrapper.

by (180 points)
Hi! Thank you for your response.

I've gone with the second approach, as we don't control the server side, and the third solution overwhelms my knowledge about telnet protocol.

I've managed to add the Telnet interpreter behind the SSH connection and now I don't get that characters anymore. Still need time to evaluate further side effects but, for now, it's a perfectly valid solution.

Thank you, once again!
0 votes
by (72.7k points)

Can you please create the Verbose log of the communication and send it to support@rebex.net for analysis? I need to see the exact bytes to tell you more.

The Verbose log can be created like this:

var telnet = new Rebex.Net.Telnet(...);
telnet.LogWriter = new Rebex.FileLogWriter(@"c:\data\telnet.log", Rebex.LogLevel.Verbose);
by (180 points)
Done. An email was sent yesterday. Thank you
by (72.7k points)
Thank you, I am investigating it.
...