Skip to content

Add networking for target_os = "wasi"#1548

Closed
haraldh wants to merge 3 commits intotokio-rs:masterfrom
haraldh:wasi
Closed

Add networking for target_os = "wasi"#1548
haraldh wants to merge 3 commits intotokio-rs:masterfrom
haraldh:wasi

Conversation

@haraldh
Copy link
Contributor

@haraldh haraldh commented Feb 15, 2022

haraldh and others added 3 commits February 4, 2022 11:37
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>
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

Successfully merging this pull request may close these issues.

1 participant