wasi-tcp-server

Crates.iowasi-tcp-server
lib.rswasi-tcp-server
version0.1.1
sourcesrc
created_at2022-07-09 15:21:08.079005
updated_at2022-07-09 16:12:10.648127
descriptionwasi tcp server
homepage
repository
max_upload_size
id622564
size3,746
Broken Pipe (btwiuse)

documentation

README

wasi tcp server

Adapted from https://github.com/second-state/wasmedge_wasi_socket/blob/main/examples/tcp_listener.rs with annotations.

image

The following command compiles the Rust program.

$ cargo build --target wasm32-wasi --release

Install WasmEdge

$ curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash
$ source $HOME/.wasmedge/env

The following command runs the application in WasmEdge.

$ wasmedge target/wasm32-wasi/release/wasi-tcp-server.wasm
listening at 127.0.0.1:1234

Use netcat to connect

$ nc localhost 1234
Commit count: 0

cargo fmt