Skip to content

Renci.SshNet.Common.SshConnectionException: An established connection was aborted by the server #578

Closed
@harsh288

Description

@harsh288

I 'm using Rencii package and it used to work however when I do List Directory which has got more than 2000 files, that is where it's breaking and giving established connection was aborted.

using System;
using System.Collections.Generic;
using System.IO;
using Renci.SshNet;
namespace worship_sync
{
class Program
{
static void Main(string[] args)
{
const string host = "******";
const string username = "****";
const string password = "vagrant";
const string workingdirectory = "*****";
const string uploadfile = #"******";
Console.WriteLine("Creating client and connecting");
using (SftpClient client = new SftpClient(host, 8822, username, password))
{
client.Connect();
Console.WriteLine("Connected to {0}", host);
client.ChangeDirectory(workingdirectory);
Console.WriteLine("Changed directory to {0}", workingdirectory);
var listDirectory = client.ListDirectory(workingdirectory); // ERROR
Console.WriteLine("Listing directory:");
foreach (var fi in listDirectory)
{
Console.WriteLine(" - " + fi.Name);
}   
}
}
}
}

AND I got this error when I am runing my code: Unhandled Exception: Renci.SshNet.Common.SshConnectionException: An established connection was aborted by the server.

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