1# zx_socket_create
2
3## NAME
4
5socket_create - create a socket
6
7## SYNOPSIS
8
9```
10#include <zircon/syscalls.h>
11
12zx_status_t zx_socket_create(uint32_t options,
13                             zx_handle_t* out0, zx_handle_t* out1);
14
15```
16
17## DESCRIPTION
18
19**socket_create**() creates a socket, a connected pair of
20bidirectional stream transports, that can move only data, and that
21have a maximum capacity.
22
23Data written to one handle may be read from the opposite.
24
25The *options* must set either the **ZX_SOCKET_STREAM** or
26**ZX_SOCKET_DATAGRAM** flag.
27
28The **ZX_SOCKET_HAS_CONTROL** flag may be set to enable the
29socket control plane.
30
31The **ZX_SOCKET_HAS_ACCEPT** flag may be set to enable transfer
32of sockets over this socket via **socket_share**() and **socket_accept**().
33
34## RIGHTS
35
36TODO(ZX-2399)
37
38## RETURN VALUE
39
40**socket_create**() returns **ZX_OK** on success. In the event of
41failure, one of the following values is returned.
42
43## ERRORS
44
45**ZX_ERR_INVALID_ARGS**  *out0* or *out1* is an invalid pointer or NULL or
46*options* is any value other than **ZX_SOCKET_STREAM** or **ZX_SOCKET_DATAGRAM**.
47
48**ZX_ERR_NO_MEMORY**  Failure due to lack of memory.
49There is no good way for userspace to handle this (unlikely) error.
50In a future build this error will no longer occur.
51
52## LIMITATIONS
53
54The maximum capacity is not currently set-able.
55
56## SEE ALSO
57
58[socket_accept](socket_accept.md),
59[socket_read](socket_read.md),
60[socket_share](socket_share.md),
61[socket_write](socket_write.md).
62