-
Notifications
You must be signed in to change notification settings - Fork 817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there away to allow an application to open a TCP socket? #1110
Comments
I'm just a lurker here; I came here looking for information on the same subject. My understanding (and I'm still quite unfamiliar with WebAssembly) is that it's not possible to open just any socket on the system from WebAssembly; you will have to open a socket from outside WebAssembly and then pass it to the runtime. You will then be able to read and write the socket via WASI; This thread implies that it functions similarly to POSIX systems, wherein the socket is manipulated like a file descriptor. I'm not sure if Wasmer currently supports sockets; I can see constants relating to sockets in the Rust I would also suggest looking into the documentation for Wasmer; you might find more detailed information than with which I am able to provide you. I'm going to do some more reading; I will update if I learn more details; I will include links if I come across anything relevant. |
@Neightro Thanks! That's good information. Sorry about the lack of response to this issue, it must have fallen through the cracks. Yeah, opening sockets depends on your ABI providing imports that let you do so. Our Emscripten implementation, which is minimally/not sandboxed allows programs to use sockets. Additionally, you can do the "no ABI", or rather the "custom ABI" approach where you implement a socket API yourself with imports so that it works with your program.
I believe we have some experimental code in It is possible to use the WASI virutal filesystem to implement networked files (the same way we implemented the framebuffer). It's a hack but it's something you could do today if you wanted to have networked WASI applications in Wasmer. The biggest issue with the hacks such as custom imports or special files is that no existing socket code will "just work" with it. |
@MarkMcCaskey any updates for socket support now despite the wasi virtual fs network files implementation? : ) |
We have a work-in-progress branch that fully supports sockets: |
We have another branch (a reb00t) with socket and epoll support, https://github.com/wasmerio/wasmer/tree/wasio-reboot-event-based-socket2/lib/wasi-experimental-network/examples. There is a Rust frontend, and implementation in WASI libc and Zig is also coming, https://github.com/ziglang/zig/compare/master...Hywan:feat-wasi-experimental-networking?expand=1. Note: It's super experimental for the moment. The idea is not to make it the new standard but to experiment as a community, and see what's missing, what are the challenges etc. |
Any update on this? |
This was added in 62de9c5 which has been merged to master, and will be part of the 3.0 release |
We have a C application that opens a TCP socket, is there a way to allow/control which TCP can be opened?
The text was updated successfully, but these errors were encountered: