Skip to content

Executing different commands using same object throwing Renci.SshNet.Common.SshConnectionException: An established connection was aborted by the server. #213

Closed
@vvvarunv

Description

@vvvarunv
    public void Test_Execute_Command_Same_Object_Different_Commands()
    {
        using (var client = new SshClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
        {
            client.Connect();
            var cmd = client.CreateCommand("sh ver");
            cmd.Execute();
            //Assert.AreEqual("12345\n", cmd.Result);
            cmd.Execute();    ---> Failing here 
            //Assert.AreEqual("23456\n", cmd.Result);
            client.Disconnect();
        }

}

internal void SendMessage(Message message)
{
if (!_socket.CanWrite())
throw new SshConnectionException("Client not connected."); --> Throws exception here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions