From: Henry Rydzkowski <hrydz13@gmail.com>
Hi
My .Net 8 console application creates a socket using the System.Net.Sockets
namespace. It is compiled to wasm and run with wasmtime but I get the error
'System.PlatformNotSupportedException: System.Net.Sockets is not supported
on this platform.'. What should I do to solve this problem?
Thanks
Henry
.NET does not yet support WASI sockets -- not even experimentally. @Pavel Šavara is currently working on it. Experimental support might be available as part of .NET 10, but not in earlier releases.
However, you can use wasi-sockets in .NET by using wit-bindgen
to generate C# bindings from the wasi-sockets WIT files and using those bindings directly. componentize-dotnet
is probably the easiest way to do that. Using the bindings directly isn't idiomatic, and it isn't compatible with anything that expects System.Net.Sockets, but it does work.
Thank you Joel for your reply.
Last updated: Dec 23 2024 at 14:03 UTC