From 4364f51505bab3e102e7df92e734f0cd7a454b18 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Mon, 22 Jan 2024 18:06:08 -0800 Subject: [PATCH] Update to the latest wasi-sockets. (#40) * Update to the latest wasi-sockets. Update to the latest wasi-sockets. This just contains documentation changes, and no interface changes. * Update generated files. --- command.md | 121 +++++++++++++++++++++++++-------------- imports.md | 121 +++++++++++++++++++++++++-------------- wit/deps.lock | 4 +- wit/deps/sockets/tcp.wit | 116 +++++++++++++++++++++++++------------ wit/deps/sockets/udp.wit | 12 ++-- 5 files changed, 243 insertions(+), 131 deletions(-) diff --git a/command.md b/command.md index 263c2ac..3d92c20 100644 --- a/command.md +++ b/command.md @@ -1859,20 +1859,21 @@ supported size.

If the IP address is zero (0.0.0.0 in IPv4, :: in IPv6), it is left to the implementation to decide which network interface(s) to bind to. If the port is zero, the socket will be bound to a random free port.

-

Unlike in POSIX, this function is async. This enables interactive WASI hosts to inject permission prompts.

-

Typical start errors

+

Typical errors

-

Typical finish errors

- +

Implementors note

+

Unlike in POSIX, in WASI the bind operation is async. This enables +interactive WASI hosts to inject permission prompts. Runtimes that +don't want to make use of this ability can simply call the native +bind as part of either start-bind or finish-bind.

References

resource tcp-socket

-

A TCP socket handle.

+

A TCP socket resource.

+

The socket can be in one of the following states:

+ +

Note: Except where explicitly mentioned, whenever this documentation uses +the term "bound" without backticks it actually means: in the bound state or higher. +(i.e. bound, listen-in-progress, listening, connect-in-progress or connected)

+

In addition to the general error codes documented on the +network::error-code type, TCP socket methods may always return +error(invalid-state) when in the closed state.

Functions

[method]tcp-socket.start-bind: func

Bind the socket to a specific network on the provided IP address and port.

If the IP address is zero (0.0.0.0 in IPv4, :: in IPv6), it is left to the implementation to decide which network interface(s) to bind to. If the TCP/UDP port is zero, the socket will be bound to a random free port.

-

Unlike in POSIX, this function is async. This enables interactive WASI hosts to inject permission prompts.

-

Typical start errors

+

Bind can be attempted multiple times on the same socket, even with +different arguments on each iteration. But never concurrently and +only as long as the previous bind failed. Once a bind succeeds, the +binding can't be changed anymore.

+

Typical errors

-

Typical finish errors

-