Downloaded the latest version, unzip, compiles, everything good so far.
Look for examples on how to simply connect to a host. Hmm. Web site suggests looking at all of the test cases. Ok, look for test cases. Nope. No test cases, no test directory no test files.
Spent better half of day looking for something to show an example of a simple connection.
Found a scrap where you can specify a port forward. Ok, close, but perhaps not enough?
What I'm trying to do:
Connect to a cellular modem that's attached to my PC and get configuration info. I can do this through Putty without a hitch. Want to add code to my app to do this automatically.
Code:
using (var client = new SshClient(IPAddress, "admin", Password))
{
Error received:"Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection."
Notes:
Look for examples on how to simply connect to a host. Hmm. Web site suggests looking at all of the test cases. Ok, look for test cases. Nope. No test cases, no test directory no test files.
Spent better half of day looking for something to show an example of a simple connection.
Found a scrap where you can specify a port forward. Ok, close, but perhaps not enough?
What I'm trying to do:
Connect to a cellular modem that's attached to my PC and get configuration info. I can do this through Putty without a hitch. Want to add code to my app to do this automatically.
Code:
using (var client = new SshClient(IPAddress, "admin", Password))
{
client.HostKeyReceived += client_HostKeyReceived;
client.Connect();
var sshCMD = client.CreateCommand("get"); // modem specific command to send config data
sshCMD.Execute(); // Exception here - see note below
var myres = sshCMD.Result;
.
.
.
client.Disconnect();
}Error received:"Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection."
Notes:
-
Thinking perhaps this is some kind of buffer overflow, I specified a command that would normally only return a small number of characters (<30) and it errors the same.
-
Looked for the "test" cases across the web, and there's a few bits here and there, but none of the code shows the basic flow of connect->command->result