EldoS | Feel safer!

Software components for data protection, secure storage and transfer

"SSH connection already established" error

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
#19185
Posted: 02/22/2012 13:29:41
by Andy Gardner (SUPPORT DISABLED)
Joined: 02/17/2012
Posts: 51

Is it possible to have an TElSimpleSSHClient connection and a TElSimpleSFTPClient connection to the same computer at the same time?

I have re-implemented my class for passing commands through the SSH client to reuse the existing instance of TElSimpleSSHClient, but I am still getting the exception with the "SSH connection already established" message.

The exception occurs during the constructor of my SSHProcess class (see below) when ExecuteCommand is called.

Code
public SSHProcess(TElSimpleSSHClient sshClient, string command)
{
    this.sshClient = sshClient;

    ...

    byte[] stdErrData = new byte[BUFFER_SIZE];
    byte[] stdOutData = sshClient.ExecuteCommand(
        command,
        ref stdErrData);

    ...
}


Here is the relevant stack trace:
Quote
SBSimpleSSH.EElSimpleSSHClientError was caught
Message=SSH connection already established
Source=SecureBlackbox.SSHClient
ErrorCode=0
StackTrace:
at SBSimpleSSH.TElSimpleSSHClient.Open()
at SBSimpleSSH.TElSimpleSSHClient.InternalExecuteCommand(String Cmd, Byte[]& StdErrData, Boolean RedirectStdErr)
at SBSimpleSSH.TElSimpleSSHClient.ExecuteCommand(String Cmd, Byte[]& StdErrData)


What am I doing wrong?

Thanks,

Andy
#19194
Posted: 02/23/2012 03:22:32
by Vsevolod Ievgiienko (EldoS Corp.)

Could you please create a ticket in Helpdesk (https://www.eldos.com/helpdesk/index.php) and post a full project there. If will be easier to find out what is wrong.

The only reason could be that sshClient is already connected to the server before it is passed as a constructor parameter.
#19202
Posted: 02/24/2012 09:01:11
by Andy Gardner (SUPPORT DISABLED)
Joined: 02/17/2012
Posts: 51

I misunderstood the proper usage. I thought that you needed to open the connection before calling ExecuteCommand and I didn't realize that calling ExecuteCommand would open the connection.

I removed my call of Open() and that eliminated this error.

Thank you
#19204
Posted: 02/24/2012 10:58:32
by Eugene Mayevski (EldoS Corp.)

Please ignore my last message. Open is indeed called inside.


Sincerely yours
Eugene Mayevski

Reply

Statistics

Topic viewed 2440 times

Number of guests: 2, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!