Shut down socket send and receive channels.
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.
;;; Note: This is similar to `shutdown` in POSIX. ;;; Shut down socket send and receive channels. (@interface func (export "sock_shutdown") (param $fd $fd) ;;; Which channels on the socket to shut down. (param $how $sdflags) (result $error (expected (error $errno))) )
ctx: A mutable reference to the function environment.
sock: The file descriptor of the socket to shut down.
how: Specifies which channels on the socket to shut down.
The function returns an
Errno value. If the operation is successful,
Errno::Success is returned. Otherwise, an appropriate
Errno value indicating the error is returned.
sock_shutdown()function allows you to shut down the send and/or receive channels of a socket.
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 corresponding
std::net::Shutdownenum variant and passes it to the underlying socket's
- The specific behavior of the
sock_shutdown()function may vary depending on the runtime environment and underlying networking implementation.