Skip to content

Conversation

@badeend
Copy link
Member

@badeend badeend commented Jan 10, 2026

The documentation of tcp-socket::listen mentions:

If the socket is not already explicitly bound, this function will implicitly bind the socket to a random free port.

I've recently added tests for this in wasmtime.
The tests ran fine on Linux and MacOS but failed on Windows. Apparently, Windows does not perform an implicit bind as part of listen.
I've updated wasmtime to perform the bind explicitly if the guest hasn't already done so. This makes it behave the same on all platforms.

This PR adds a note on listen clarifying the expected WASI behavior and observed OS behavior.

@badeend badeend requested a review from a team as a code owner January 10, 2026 10:35
@badeend badeend added the P-sockets Proposal: wasi-sockets label Jan 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P-sockets Proposal: wasi-sockets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants