Skip to content

Commit 2bf9c47

Browse files
badeendricochet
andauthored
sockets: Update documentation (#884)
* Update sockets documentation: - Limit the prose to about 80 characters per line. - Describe POSIX equivalents of the error codes. - Removed outdated `stream` info from: - `resolve-addresses` - `tcp-socket::receive` - Describe shared ownership semantics of sockets and their streams/futures as we landed on in #870 - Capture the "lessons learned" so far: - TCP & UDP `connect` may update the socket's local address. See bytecodealliance/wasmtime#12589 - TCP `bind` should always set SO_REUSEADDR. See bytecodealliance/wasmtime#12402 - send/receive buffer sizes may be dynamically adjusted by the OS. See bytecodealliance/wasmtime#12561 - Windows does not perform an implicit bind on UDP `send`. * Update proposals/sockets/wit-0.3.0-draft/types.wit Co-authored-by: Bailey Hayes <ricochet@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Bailey Hayes <ricochet@users.noreply.github.com> --------- Co-authored-by: Bailey Hayes <ricochet@users.noreply.github.com>
1 parent b16a206 commit 2bf9c47

File tree

3 files changed

+151
-75
lines changed

3 files changed

+151
-75
lines changed

proposals/sockets/TcpSocketOperationalSemantics-0.3.0-draft.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ stateDiagram-v2
3333
state "closed" as Closed
3434
3535
36-
[*] --> Unbound: create-tcp-socket() -> ok
36+
[*] --> Unbound: create() -> ok
3737
Unbound --> Bound: bind() -> ok
3838
Unbound --> Connecting: connect()
3939

proposals/sockets/wit-0.3.0-draft/ip-name-lookup.wit

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ interface ip-name-lookup {
77
@since(version = 0.3.0-rc-2026-02-09)
88
enum error-code {
99
/// Unknown error
10+
///
11+
/// This is an escape hatch for WASI implementations to handle failures
12+
/// that can not be categorized under any of the other error codes.
1013
unknown,
1114

1215
/// Access denied.
@@ -37,9 +40,9 @@ interface ip-name-lookup {
3740

3841
/// Resolve an internet host name to a list of IP addresses.
3942
///
40-
/// Unicode domain names are automatically converted to ASCII using IDNA encoding.
41-
/// If the input is an IP address string, the address is parsed and returned
42-
/// as-is without making any external requests.
43+
/// Unicode domain names are automatically converted to ASCII using IDNA
44+
/// encoding. If the input is an IP address string, the address is parsed
45+
/// and returned as-is without making any external requests.
4346
///
4447
/// See the wasi-socket proposal README.md for a comparison with getaddrinfo.
4548
///
@@ -49,9 +52,6 @@ interface ip-name-lookup {
4952
/// with at least one address. Additionally, this function never returns
5053
/// IPv4-mapped IPv6 addresses.
5154
///
52-
/// The returned future will resolve to an error code in case of failure.
53-
/// It will resolve to success once the returned stream is exhausted.
54-
///
5555
/// # References:
5656
/// - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getaddrinfo.html>
5757
/// - <https://man7.org/linux/man-pages/man3/getaddrinfo.3.html>

0 commit comments

Comments
 (0)