1# zx_socket_create 2 3## NAME 4 5<!-- Updated by update-docs-from-abigen, do not edit. --> 6 7socket_create - create a socket 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_create(uint32_t options, 17 zx_handle_t* out0, 18 zx_handle_t* out1); 19``` 20 21## DESCRIPTION 22 23`zx_socket_create()` creates a socket, a connected pair of 24bidirectional stream transports, that can move only data, and that 25have a maximum capacity. 26 27Data written to one handle may be read from the opposite. 28 29The *options* must set either the **ZX_SOCKET_STREAM** or 30**ZX_SOCKET_DATAGRAM** flag. 31 32The **ZX_SOCKET_HAS_CONTROL** flag may be set to enable the 33socket control plane. 34 35The **ZX_SOCKET_HAS_ACCEPT** flag may be set to enable transfer 36of sockets over this socket via [`zx_socket_share()`] and [`zx_socket_accept()`]. 37 38## RIGHTS 39 40<!-- Updated by update-docs-from-abigen, do not edit. --> 41 42TODO(ZX-2399) 43 44## RETURN VALUE 45 46`zx_socket_create()` returns **ZX_OK** on success. In the event of 47failure, one of the following values is returned. 48 49## ERRORS 50 51**ZX_ERR_INVALID_ARGS** *out0* or *out1* is an invalid pointer or NULL or 52*options* is any value other than **ZX_SOCKET_STREAM** or **ZX_SOCKET_DATAGRAM**. 53 54**ZX_ERR_NO_MEMORY** Failure due to lack of memory. 55There is no good way for userspace to handle this (unlikely) error. 56In a future build this error will no longer occur. 57 58## LIMITATIONS 59 60The maximum capacity is not currently set-able. 61 62## SEE ALSO 63 64 - [`zx_socket_accept()`] 65 - [`zx_socket_read()`] 66 - [`zx_socket_share()`] 67 - [`zx_socket_shutdown()`] 68 - [`zx_socket_write()`] 69 70<!-- References updated by update-docs-from-abigen, do not edit. --> 71 72[`zx_socket_accept()`]: socket_accept.md 73[`zx_socket_read()`]: socket_read.md 74[`zx_socket_share()`]: socket_share.md 75[`zx_socket_shutdown()`]: socket_shutdown.md 76[`zx_socket_write()`]: socket_write.md 77