1# zx_socket_accept 2 3## NAME 4 5<!-- Updated by update-docs-from-abigen, do not edit. --> 6 7socket_accept - receive another socket object via 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_accept(zx_handle_t handle, zx_handle_t* out_socket); 17``` 18 19## DESCRIPTION 20 21`zx_socket_accept()` attempts to receive a new socket via an existing socket 22connection. The signal **ZX_SOCKET_ACCEPT** is asserted when there is a new 23socket available. 24 25## RIGHTS 26 27<!-- Updated by update-docs-from-abigen, do not edit. --> 28 29*handle* must be of type **ZX_OBJ_TYPE_SOCKET** and have **ZX_RIGHT_READ**. 30 31## RETURN VALUE 32 33`zx_socket_accept()` returns **ZX_OK** on success and the received handle 34is returned via *out_socket*. In the event of failure, one of the following 35values is returned. 36 37## ERRORS 38 39**ZX_ERR_BAD_HANDLE** *socket* is invalid. 40 41**ZX_ERR_WRONG_TYPE** *socket* is not a socket handle. 42 43**ZX_ERR_ACCESS_DENIED** *socket* lacks **ZX_RIGHT_READ**. 44 45**ZX_ERR_INVALID_ARGS** *out_socket* is an invalid pointer. 46 47**ZX_ERR_SHOULD_WAIT** There is no new socket ready to be accepted. 48 49**ZX_ERR_NOT_SUPPORTED** This socket does not support the transfer of sockets. 50It was not created with the **ZX_SOCKET_HAS_ACCEPT** option. 51 52## LIMITATIONS 53 54The socket accept queue is only one element deep. 55 56## SEE ALSO 57 58 - [`zx_socket_create()`] 59 - [`zx_socket_read()`] 60 - [`zx_socket_share()`] 61 - [`zx_socket_shutdown()`] 62 - [`zx_socket_write()`] 63 64<!-- References updated by update-docs-from-abigen, do not edit. --> 65 66[`zx_socket_create()`]: socket_create.md 67[`zx_socket_read()`]: socket_read.md 68[`zx_socket_share()`]: socket_share.md 69[`zx_socket_shutdown()`]: socket_shutdown.md 70[`zx_socket_write()`]: socket_write.md 71