Quantcast
Channel: sshnet Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1729

New Post: Mono Support?

$
0
0
I see Mono support is listed but I am not able to get this code to execute correct via Mono.

Here is the code I am running:
            using (SshClient ssh = new SshClient(host,username,password))
            {
                try {
                    ssh.Connect();

                    var cmd = ssh.CreateCommand("ls -l");   //  very long list
                    var asynch = cmd.BeginExecute(delegate(IAsyncResult ar)
                                                  {
                        Console.WriteLine("Finished.");
                    }, null);
                    
                    var reader = new StreamReader(cmd.OutputStream);
                    
                    while (!asynch.IsCompleted)
                    {
                        var result = reader.ReadToEnd();
                        if (string.IsNullOrEmpty(result))
                            continue;
                        Console.Write(result);

                    }
                    cmd.EndExecute(asynch);
                }
                catch (Exception ex){
                    Console.WriteLine (ex.Message + Environment.NewLine + ex.StackTrace);

                }
            }
Here are the results:

No suitable authentication method found to complete authentication.
at Renci.SshNet.ConnectionInfo.Authenticate (Renci.SshNet.Session session) [0x0009f] in .../Renci.SshNet/ConnectionInfo.cs:413
at Renci.SshNet.Session.Connect () [0x00322] in .../Renci.SshNet/Session.cs:558
at Renci.SshNet.BaseClient.Connect () [0x0005b] in .../Renci.SshNet/BaseClient.cs:117
at SSH_TEST.MainClass.Main (System.String[] args) [0x0001b] in .../SSH_TEST/Main.cs:21


Has anyone been able to compile and execute the Renci.SshNet solution via MonoDevelop in OSX?

This same code runs just fine in VS2010...

Viewing all articles
Browse latest Browse all 1729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>