Shut down socket send and receive channels.
The sock_shutdown() function is used to shut down the send and receive channels of a socket. It is similar to the shutdown function in POSIX. The function allows you to selectively shut down either the send channel, the receive channel, or both channels of the socket.
Notes
- The
sock_shutdown()function allows you to shut down the send and/or receive channels of a socket. - The
howparameter specifies which channels to shut down. It can take one of the following values:__WASI_SHUT_RD: Shut down the receive channel.__WASI_SHUT_WR: Shut down the send channel.__WASI_SHUT_RD | __WASI_SHUT_WR: Shut down both the send and receive channels.
- The function maps the
howvalue to the correspondingstd::net::Shutdownenum variant and passes it to the underlying socket'sshutdown()method. - The specific behavior of the
sock_shutdown()function may vary depending on the runtime environment and underlying networking implementation.
| Type | Value | Description |
|---|---|---|
SHUT_RD |
1 | Shut down the receive channel |
SHUT_WR |
2 | Shut down the send channel. |
SHIT_RDWR |
3 | Shut down both the send and receive channels. |