Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the same port for TCP and WebSocket #2684

Open
NihiliumOnMarz opened this issue Jan 14, 2024 · 5 comments
Open

Use the same port for TCP and WebSocket #2684

NihiliumOnMarz opened this issue Jan 14, 2024 · 5 comments
Labels
kind/enhancement A net-new feature or improvement to an existing feature P3 Low: Not priority right now

Comments

@NihiliumOnMarz
Copy link

NihiliumOnMarz commented Jan 14, 2024

I am trying to listen on /tcp/1111, /tcp/1111/ws, and /tcp/1111/tls/ws and getting error bind: Only one usage of each socket address (protocol/network address/port) is normally permitted."}

I thought LibP2P was capable of this?

@Jorropo
Copy link
Contributor

Jorropo commented Jan 15, 2024

This has to be implemented manually in each transport (see https://grep.app/search?q=quicreuse&filter[repo][0]=libp2p/go-libp2p).
AFAIK this is only implemented across quic* and webrtc transports now.

@NihiliumOnMarz
Copy link
Author

This has to be implemented manually in each transport (see https://grep.app/search?q=quicreuse&filter[repo][0]=libp2p/go-libp2p). AFAIK this is only implemented across quic* and webrtc transports now.

Looking through the code in TCP transport it has an option for reuse port but I do not see it in websocket transport. Is there an easy way to add?

@Stebalien
Copy link
Member

Looking through the code in TCP transport it has an option for reuse port but I do not see it in websocket transport. Is there an easy way to add?

Not easily, no. It's not just a matter of saying "reuse this port", you need to be able to detect that the connection is not for you and pass it off to the correct transport.

@sukunrt sukunrt changed the title TCP Bind issue Use the same port for TCP and WebSocket Jan 24, 2024
@sukunrt sukunrt added the kind/enhancement A net-new feature or improvement to an existing feature label Jan 24, 2024
@MarcoPolo
Copy link
Contributor

@NihiliumOnMarz is there a specific use case you need this for?

@Jorropo
Copy link
Contributor

Jorropo commented Mar 16, 2024

Related libp2p/specs#608 I'll submit a PoC.

@sukunrt sukunrt added the P3 Low: Not priority right now label Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement A net-new feature or improvement to an existing feature P3 Low: Not priority right now
Projects
None yet
Development

No branches or pull requests

5 participants