Columns setting not working on SSH connection - WeOnlyDo Discussion board

Columns setting not working on SSH connection (General questions)

by Hannes Lowette, Tuesday, January 24, 2012, 11:41 (4484 days ago)

I'm evaluating the wodSSH component for SSH and telnet connections in .Net. Everything seems to work as expected, except for the Columns property. There is no response to setting it. The returned output is ALWAYS 80 chars wide (what I assume is the default setting).

When I connect to the same SSH server with a stand alone tool, I can change the output width without a problem.

Re: Columns setting not working on SSH connection

by woddrazen, Tuesday, January 24, 2012, 12:14 (4484 days ago) @ Hannes Lowette

Hi Hannes,


Did you maybe try out samples? Does the same issue occur there?

Also, where did you set this Columns Property inside your code?


Regards,
Drazen

Re: Columns setting not working on SSH connection

by Hannes Lowette, Tuesday, January 24, 2012, 12:54 (4484 days ago) @ woddrazen

[code]
this.sshClient = new SSH
{
Protocol = SSH.SupportedProtocols.SSHAuto,
Login = user,
Password = password,
Hostname = ipAddress,
Port = 22,
Blocking = true,
Timeout = 500,
Columns = 100,
Rows = 250,
Version = 2.5.3.139
};

try
{
this.sshClient.Connect();
string sshOutput;
do
{
sshOutput = this.sshClient.Receive();
}
while (!sshOutput.Trim().EndsWith(Prompt));
}
catch (Exception)
{
throw new ConnectionFailedException();
}
[/code]

Re: Columns setting not working on SSH connection

by woddrazen, Tuesday, January 24, 2012, 14:02 (4484 days ago) @ Hannes Lowette

Hannes,


It works on my side. What happens if you execute some command and receive output?

You can find example how to send command to server here:
http://www.weonlydo.com/code.asp?did=Send-multiple-commands-to-SSH-server-using-synchronous-connection

This property does not affect any of the client's behavior because wodSSH.NET does not have it's own GUI. When connecting to the server this value is sent to enable the server to adjust it's display area, so that when data is sent to the client it is adjusted properly.


Drazen

Re: Columns setting not working on SSH connection

by Hannes Lowette, Tuesday, January 24, 2012, 15:03 (4484 days ago) @ woddrazen

If I connect using putty for instance, the output of my test commands scales with the screen size.

When I use your SSH component, I receive a newline every 80 characters, where I'd expect it to be every 100 characters when I set this property.

An ideas?

Re: Columns setting not working on SSH connection

by woddrazen, Tuesday, January 24, 2012, 15:43 (4484 days ago) @ Hannes Lowette

Hannes,


Can you maybe try something like this and check how it works.
[code] WeOnlyDo.Client.SSH ssh1 = new WeOnlyDo.Client.SSH();

ssh1.Hostname = your_hostname ;
ssh1.Blocking = true;
ssh1.Login = your_login ;
ssh1.Password = your_password ;
ssh1.Protocol = WeOnlyDo.Client.SSH.SupportedProtocols.SSH2;
ssh1.Columns = 200;
ssh1.Connect();

ssh1.WaitFor( regex:[\$ #>] $ );
ssh1.DataReady = 0;
Console.WriteLine(ssh1.Execute( echo 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
, regex:[\$ #>] $ ));[/code]
you should received output inside one column because Columns Property ti set to 200.


Drazen