sshnet / sshnet/SSH.NET

max remote forwarded ports?

Open
#716 0 comments 0 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

the below code (on Windows) generates an exception after starting 505 ports on Centos8: "port forwarding for 127.0.0.1 port 50000 failed to start"

var client = new SshClient("centos", "user1", "password1");
try
{
	client.Connect();

	for (uint i = 60001; i <= 61000; i++)
	{
		var port = new ForwardedPortRemote(i, "127.0.0.1", 50000);
		client.AddForwardedPort(port);
		port.Start();
	}
}
catch (Exception x)
{
	MessageBox.Show(x.Message);
}

is it SSH.NET limitation or Windows limitation?

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 ForwardedPortRemote loop shown in the issue and reproduce the failure after roughly 505 ports on Windows against CentOS 8. Trace the exception from port.Start() and compare the behavior with the SSH.NET, Windows, and server-side limits; done means identifying which component imposes the limit and recording the evidence or required change.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.