You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// - the socket is transitioned into the Connection state
85
+
/// - the socket is transitioned into the `connection` state.
61
86
/// - a pair of streams is returned that can be used to read & write to the connection
62
87
///
63
-
/// After a failed connection attempt, the only valid action left is to
64
-
/// `drop` the socket. A single socket can not be used to connect more than once.
88
+
/// After a failed connection attempt, the socket will be in the `closed`
89
+
/// state and the only valid action left is to `drop` the socket. A single
90
+
/// socket can not be used to connect more than once.
65
91
///
66
-
/// # Typical `start` errors
92
+
/// # Typical errors
67
93
/// - `invalid-argument`: The `remote-address` has the wrong address family. (EAFNOSUPPORT)
68
94
/// - `invalid-argument`: `remote-address` is not a unicast address. (EINVAL, ENETUNREACH on Linux, EAFNOSUPPORT on MacOS)
69
95
/// - `invalid-argument`: `remote-address` is an IPv4-mapped IPv6 address. (EINVAL, EADDRNOTAVAIL on Illumos)
70
96
/// - `invalid-argument`: The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EADDRNOTAVAIL on Windows)
71
97
/// - `invalid-argument`: The port in `remote-address` is set to 0. (EADDRNOTAVAIL on Windows)
72
98
/// - `invalid-argument`: The socket is already attached to a different network. The `network` passed to `connect` must be identical to the one passed to `bind`.
73
-
/// - `invalid-state`: The socket is already in the Connection state. (EISCONN)
74
-
/// - `invalid-state`: The socket is already in the Listener state. (EOPNOTSUPP, EINVAL on Windows)
75
-
///
76
-
/// # Typical `finish` errors
99
+
/// - `invalid-state`: The socket is already in the `connected` state. (EISCONN)
100
+
/// - `invalid-state`: The socket is already in the `listening` state. (EOPNOTSUPP, EINVAL on Windows)
/// - `connection-refused`: The connection was forcefully rejected. (ECONNREFUSED)
79
103
/// - `connection-reset`: The connection was reset. (ECONNRESET)
80
104
/// - `connection-aborted`: The connection was aborted. (ECONNABORTED)
81
105
/// - `remote-unreachable`: The remote address is not reachable. (EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
82
106
/// - `address-in-use`: Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD)
83
-
/// - `not-in-progress`: A `connect` operation is not in progress.
107
+
/// - `not-in-progress`: A connect operation is not in progress.
84
108
/// - `would-block`: Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN)
85
109
///
110
+
/// # Implementors note
111
+
/// The POSIX equivalent of `start-connect` is the regular `connect` syscall.
112
+
/// Because all WASI sockets are non-blocking this is expected to return
113
+
/// EINPROGRESS, which should be translated to `ok()` in WASI.
114
+
///
115
+
/// The POSIX equivalent of `finish-connect` is a `poll` for event `POLLOUT`
116
+
/// with a timeout of 0 on the socket descriptor. Followed by a check for
117
+
/// the `SO_ERROR` socket option, in case the poll signaled readiness.
0 commit comments