Stream: wasmtime

Topic: ✔ Question about socket usage


view this post on Zulip Cwasi4wasm (Jan 09 2024 at 20:17):

After I have inherited the network in my WasiCtx for my component is it possible to use std::net::TCP::connect in my wasm program or do I need a specialized one?

view this post on Zulip Joel Dice (Jan 09 2024 at 20:33):

For the time being, you'll need to use my Rust and wasi-sdk forks. There are instructions for building them at https://github.com/dicej/wasi-sockets-tests. We're working on getting support upstreamed, but it will be a long process.

Test harness for prototyping support for wasi-sockets in the Rust std library and wasi-libc - GitHub - dicej/wasi-sockets-tests: Test harness for prototyping support for wasi-sockets in the Rust st...

view this post on Zulip Cwasi4wasm (Jan 09 2024 at 20:34):

Awesome thank you for the info! I will take a look at this

view this post on Zulip Joel Dice (Jan 09 2024 at 20:35):

Alternatively, you can use the wit-bindgen-generated bindings directly if you don't need compatibility with the std types.

view this post on Zulip Cwasi4wasm (Jan 09 2024 at 20:36):

Would I have to add wasi_sockets to my deps for wit bindgen by any chance? Sorry about the multiple questions very new to using wit

view this post on Zulip Joel Dice (Jan 09 2024 at 20:39):

You'd need to target a world that imports the wasi:sockets/tcp and wasi:sockets/network interfaces. The wasi:cli/imports world does, for example.

view this post on Zulip Cwasi4wasm (Jan 09 2024 at 20:40):

Awesome thank you I will try this!

view this post on Zulip Notification Bot (Jan 10 2024 at 20:40):

Cwasi4wasm has marked this topic as resolved.


Last updated: Nov 22 2024 at 16:03 UTC