1# zx_socket_shutdown
2
3## NAME
4
5<!-- Updated by update-docs-from-abigen, do not edit. -->
6
7socket_shutdown - prevent reading or writing
8
9## SYNOPSIS
10
11<!-- Updated by update-docs-from-abigen, do not edit. -->
12
13```
14#include <zircon/syscalls.h>
15
16zx_status_t zx_socket_shutdown(zx_handle_t handle, uint32_t options);
17```
18
19## DESCRIPTION
20
21`zx_socket_shutdown()` attempts to prevent future reads or writes on a socket,
22where options can be a combination of **ZX_SOCKET_SHUTDOWN_READ** and
23**ZX_SOCKET_SHUTDOWN_WRITE**:
24
25 * If **ZX_SOCKET_SHUTDOWN_READ** is passed to *options*, then reading is
26   disabled for the socket endpoint at *handle*. All data buffered in the socket
27   at the time of the call can be read, but further reads from this endpoint or
28   writes to the other endpoint of the socket will fail with
29   **ZX_ERR_BAD_STATE**.
30
31 * If **ZX_SOCKET_SHUTDOWN_WRITE** is passed to *options*, then writing is
32   disabled for the socket endpoint at *handle*. Further writes to this endpoint
33   or reads from the other endpoint of the socket will fail with
34   **ZX_ERR_BAD_STATE**.
35
36## RIGHTS
37
38<!-- Updated by update-docs-from-abigen, do not edit. -->
39
40*handle* must be of type **ZX_OBJ_TYPE_SOCKET** and have **ZX_RIGHT_WRITE**.
41
42## RETURN VALUE
43
44`zx_socket_shutdown()` returns **ZX_OK** on success.
45
46## ERRORS
47
48**ZX_ERR_BAD_HANDLE**  *handle* is not a valid handle.
49
50**ZX_ERR_WRONG_TYPE**  *handle* is not a socket handle.
51
52**ZX_ERR_ACCESS_DENIED**  *handle* does not have **ZX_RIGHT_WRITE**.
53
54**ZX_ERR_INVALID_ARGS** *options* contains an undefined flag.
55
56## SEE ALSO
57
58 - [`zx_socket_accept()`]
59 - [`zx_socket_create()`]
60 - [`zx_socket_read()`]
61 - [`zx_socket_share()`]
62 - [`zx_socket_write()`]
63
64<!-- References updated by update-docs-from-abigen, do not edit. -->
65
66[`zx_socket_accept()`]: socket_accept.md
67[`zx_socket_create()`]: socket_create.md
68[`zx_socket_read()`]: socket_read.md
69[`zx_socket_share()`]: socket_share.md
70[`zx_socket_write()`]: socket_write.md
71