sshnet / sshnet/SSH.NET

sftp connection issue

Open
#497 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
4.4k
Forks
993
Avg merge
9d 21h
Merged PRs (30d)
1

Description

Will it cause soket connection leak issue if I used below code in a Web application or Azure Function app? Do I need to use a static SftpClient in web app or Azure function app? Please advise. Thanks in advance.

using (var sftp = new SftpClient(host, username, password))
{
   sftp.Connect();
   var files = sftp.ListDirectory(remoteDirectory).Take(maxFiles);
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the C# example and review the SftpClient lifecycle around using, Connect, and ListDirectory in a web application or Azure Function. Document whether this pattern can leak connections and whether a static SftpClient is appropriate; the issue contains no named files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp
Domain
cloud, networking
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.