Skip to content

Commit 34f5d13

Browse files
authored
doc/socket_api.md: some historical notes (#4494)
1 parent 704aa3e commit 34f5d13

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

doc/socket_api.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,38 @@ $ iwasm --addr-pool=1.2.3.4/15,2.3.4.6/16 socket_example.wasm
8787
```
8888

8989
Refer to [socket api sample](../samples/socket-api) for the compilation of the Wasm applications and [_iwasm_ for Intel SGX](../product-mini/platforms/linux-sgx) for the Wasm runtime.
90+
91+
## The background and compatibility notes
92+
93+
### WASIp1
94+
95+
The WASIp1 provides a subset of the socket API.
96+
Namely,
97+
98+
* send()
99+
* recv()
100+
* shutdown()
101+
* accept()
102+
103+
Functionalities like connect() and listen() are intentionally omitted
104+
there to maintain the capability-based security model, inherited from
105+
cloudabi. The common practice for applications is to make the host code
106+
pass already connected/listening sockets to wasm module.
107+
108+
### WAMR extensions
109+
110+
WAMR extends the WASIp1 with the rest of socket API functionalities
111+
for convenience.
112+
113+
* socket()
114+
* connect()
115+
* bind()
116+
* listen()
117+
* some of getsockopt/setsockopt options
118+
* name resolution (a subset of getaddrinfo)
119+
120+
### Compatibilities
121+
122+
Many of runtimes (eg. Wasmer and WasmEdge) provide similar extensions.
123+
Unfortunately, they are all incompatible. Thus, portable applications
124+
should not rely on these extensions.

0 commit comments

Comments
 (0)