sta / sta/websocket-sharp

Cannot use Ephemeral port

Open
#399 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
6.1k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

Setting the port number to 0 should not throw an error.
Port 0 generally means Ephemeral port, which is the next available port within a range specified by the operating system.

Allowing developers to use Ephemeral ports enables many scenarios.
Please see
https://en.wikipedia.org/wiki/Ephemeral_port

I realise this would mean that the method calling Start would not know the port number, but this can be fixed by retriving the port number from the TcpListener after _listener.Start() is called and setting the _port variable;

Contributor guide

No contributing guide indexed for this repository

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 by tracing the TcpListener setup around _listener.Start() and the _port variable. Verify how port 0 is currently rejected, then check how the actual bound port can be retrieved after startup. Done means port 0 starts successfully and the selected port is reflected in the server state, with coverage for this behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
networking
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 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.