You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Modify the tcp_server example to support target_os = "wasi"
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
$ wasmtime run --tcplisten 127.0.0.1:9000 --env 'LISTEN_FDS=1' target/wasm32-wasi/debug/examples/tcp_server.wasm
```
Signed-off-by: Harald Hoyer <[email protected]>
0 commit comments