Add networking for target_os = "wasi"#1548
Closed
haraldh wants to merge 3 commits intotokio-rs:masterfrom
Closed
Conversation
Based on tokio-rs#1395 Co-authored-by: Thomas de Zeeuw <thomasdezeeuw@gmail.com> Signed-off-by: Harald Hoyer <harald@profian.com>
With * bytecodealliance/wasmtime#3711 * rust-lang/rust#93158 merged, mio can have limited support for networking for the `wasm32-wasi` target. Signed-off-by: Harald Hoyer <harald@profian.com>
Use the `LISTEN_FDS` mechanism to use pre-opened sockets.
Especially for `wasm32-wasi` there is no other way to get access to sockets,
than to use pre-opened sockets.
Because `wasm32-wasi` does not yet return `TcpListener::local_addr()`, an
unspecified IP address and port will be returned and displayed.
```
$ cargo +nightly build --release --example tcp_server --features="os-poll net"
Compiling ppv-lite86 v0.2.15
Compiling getrandom v0.2.3
Compiling mio v0.8.0 (/home/harald/git/mio)
Compiling env_logger v0.8.4
Compiling rand_core v0.6.3
Compiling rand_chacha v0.3.1
Compiling rand v0.8.4
Finished release [optimized] target(s) in 1.75s
$
```
Signed-off-by: Harald Hoyer <harald@profian.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With
sock_acceptand basic networking bytecodealliance/wasmtime#3711sock_acceptand enable networking rust-lang/rust#93158merged, mio can have limited support for tcp networking for the
wasm32-wasitarget.