C++ Builder 5 - SSHClient Demo - Protocol Mismatch
Posted: Mon 04 Jun 2007 21:55
Added Button1, to "send" data, and the following to routines :
void __fastcall TDemoForm::Button1Click(TObject *Sender)
{
int wrt_count;
strcpy(WriteBuf,(Edit1->Text.Trim() + "\n").c_str());
wrt_count = (Edit1->Text.Trim() + "\n").Length();
wrt_count = ScSSHChannel->WriteBuffer(WriteBuf, (Edit1->Text.Trim() + "\n").Length());
}
//---------------------------------------------------------------------------
void __fastcall TDemoForm::ScSSHChannelAsyncReceive(TObject *Sender)
{
int rec_count;
rec_count = ScSSHChannel->ReadBuffer(ReadBuf, ScSSHChannel->InCount);
}
Set Direct to true, and NonBlocking to true.
set "SSH Server" entry box to 'mou034.mto.na.mars'
set "SSH Port" to default 22
Set "User name" / "Password" appropriately.
Set "Source Port" to 22
Set "Dest Host" to 'mou034.mto.na.mars'
set "Dest Port" to 22.
I can click "Connect SSH" and "Start Port forwarding", and get response from the server (in ReadBuf) of "SSH-2.0-OpenSSH_3.9p1".
But, when I try to send, via WriteBuffer, a 'pwd' command to the server, I get a "Protocol Mismatch" back in the ReadBuf.
Any ideas ?
"
void __fastcall TDemoForm::Button1Click(TObject *Sender)
{
int wrt_count;
strcpy(WriteBuf,(Edit1->Text.Trim() + "\n").c_str());
wrt_count = (Edit1->Text.Trim() + "\n").Length();
wrt_count = ScSSHChannel->WriteBuffer(WriteBuf, (Edit1->Text.Trim() + "\n").Length());
}
//---------------------------------------------------------------------------
void __fastcall TDemoForm::ScSSHChannelAsyncReceive(TObject *Sender)
{
int rec_count;
rec_count = ScSSHChannel->ReadBuffer(ReadBuf, ScSSHChannel->InCount);
}
Set Direct to true, and NonBlocking to true.
set "SSH Server" entry box to 'mou034.mto.na.mars'
set "SSH Port" to default 22
Set "User name" / "Password" appropriately.
Set "Source Port" to 22
Set "Dest Host" to 'mou034.mto.na.mars'
set "Dest Port" to 22.
I can click "Connect SSH" and "Start Port forwarding", and get response from the server (in ReadBuf) of "SSH-2.0-OpenSSH_3.9p1".
But, when I try to send, via WriteBuffer, a 'pwd' command to the server, I get a "Protocol Mismatch" back in the ReadBuf.
Any ideas ?
"