none
Error when connect to ssh using Granados SSH RRS feed

  • Question

  • Hello!

    I'm building an application using Granados (Routrek.SSHC) to connect Ssh.

    But when i connect to host, have an error message: The destination could not be a correct SSH server

    However, i connect using bitvise client is correct. Please help me

    This is my code:

    try
                {
                    SSHConnectionParameter param = new SSHConnectionParameter();
                    param.UserName = user;
                    param.Password = pwd;
                    param.Protocol = SSHProtocol.SSH2;
                    param.AuthenticationType = AuthenticationType.Password;
                    param.WindowSize = 0x1000;
    
                    Reader reader = new Reader();
                    Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                    socket.Connect(new IPEndPoint(IPAddress.Parse(ip), 22));
    
                    var sshConnection = SSHConnection.Connect(param, reader, socket);
                    reader.SshConnection = sshConnection;
    
                    SSHChannel channel = sshConnection.ForwardPort(reader, "www.yahoo.co.jp", 80, "localhost", 1080);
                    reader.SshChannel = channel;
    
                    int iCount = 0;
                    while (true)
                    {
                        if (reader.IsReady)
                            return true;
    
                        Thread.Sleep(1000);
                        iCount++;
                        if (iCount > timeOut)
                            return false;
                    }
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.Message);
                    return false;
                }

    Monday, November 6, 2017 4:25 PM

All replies

  • If you don't get a reply, then maybe you can try StackOverFlow.
    Tuesday, November 7, 2017 2:21 AM
  • Hello LuuQuangICT,

    The Granados SSH is more related to third-party lib, you could ask question from there for suitable support.
    The Visual C# discuss and ask the C# programming language, IDE, libraries, samples and tools . If you have some grammar or code errors, please feel free to contact us. We will try our best to give you a solution.

    Sincerely,

    Neil Hu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, November 7, 2017 6:43 AM