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

tcp's listen's network parameter #28

Closed
sunfishcode opened this issue Mar 16, 2023 · 2 comments
Closed

tcp's listen's network parameter #28

sunfishcode opened this issue Mar 16, 2023 · 2 comments

Comments

@sunfishcode
Copy link
Member

Does listen in the tcp interface need its network parameter? The network is passed to bind which is the point where the address is provided, and that will have had to succeed before listen can be used on a TCP socket. So at first glance, it looks like listen doesn't need its network parameter.

@badeend
Copy link
Collaborator

badeend commented Apr 12, 2023

Depending on the OS, bind is not required before listen. If not explicitly bound, listen performs an implicit bind on INADDR_ANY with port 0.

This behavior is non-standard. For example, Windows does not support it 1 2.

I doubt any truly cross-platform application depends on this behaviour. And since it simplifies the WASI interface, I think it's fine to restrict listen to only explicitly bound sockets and getting rid of the network parameter.

sunfishcode added a commit to sunfishcode/wasi-sockets that referenced this issue May 12, 2023
As discussed in WebAssembly#28, remove the network parameter from the `start-listen`
function.

Also, document that `start-listen` fails if the socket is not bound.
This ensures the the address is checked against the network before
starting to listen.
@sunfishcode
Copy link
Member Author

The network parameter on listen was removed in #35.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants