Socket - Bidirectional streaming IPC transport
SYNOPSISSockets are a bidirectional stream transport. Unlike channels, sockets only move data (not handles).
DESCRIPTIONData is written into one end of a socket via zx_socket_write()
and read from the opposing end via zx_socket_read()
.
Upon creation, both ends of the socket are writable. Using the zx_socket_set_disposition()
system call, each end of the socket can be enabled or disabled independently, using the ZX_SOCKET_DISPOSITION_WRITE_ENABLED and ZX_SOCKET_DISPOSITION_WRITE_DISABLED.
The following properties may be queried from a socket object:
ZX_PROP_SOCKET_RX_THRESHOLD size of the read threshold of a socket, in bytes. When the bytes queued on the socket (available for reading) is equal to or greater than this value, the ZX_SOCKET_READ_THRESHOLD signal is asserted. Read threshold signalling is disabled by default (and when set, writing a value of 0 for this property disables it).
ZX_PROP_SOCKET_TX_THRESHOLD size of the write threshold of a socket, in bytes. When the space available for writing on the socket is equal to or greater than this value, the ZX_SOCKET_WRITE_THRESHOLD signal is asserted. Write threshold signalling is disabled by default (and when set, writing a value of 0 for this property disables it).
From the point of view of a socket handle, the receive buffer contains the data that is readable via zx_socket_read()
from that handle (having been written from the opposing handle), and the transmit buffer contains the data that is written via zx_socket_write()
to that handle (and readable from the opposing handle).
The following signals may be set for a socket object:
ZX_SOCKET_READABLE data is available to read from the socket
ZX_SOCKET_WRITABLE data may be written to the socket
ZX_SOCKET_PEER_CLOSED the other endpoint of this socket has been closed.
ZX_SOCKET_PEER_WRITE_DISABLED writing is disabled for the other endpoint because its disposition was set to ZX_SOCKET_DISPOSITION_WRITE_DISABLED. Reads on a socket endpoint with this signal raised will succeed so long as there is data in the socket that was written before writing was disabled.
ZX_SOCKET_WRITE_DISABLED writing is disabled for this endpoint because its disposition was set to ZX_SOCKET_DISPOSITION_WRITE_DISABLED. Writes on a socket endpoint with this signal raised will fail.
ZX_SOCKET_READ_THRESHOLD data queued up on socket for reading exceeds the read threshold.
ZX_SOCKET_WRITE_THRESHOLD space available on the socket for writing exceeds the write threshold.
SYSCALLSzx_socket_create()
- create a new socketzx_socket_read()
- read data from a socketzx_socket_set_disposition()
- set disposition of a socketzx_socket_write()
- write data to a socketExcept as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-02-28 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-28 UTC."],[],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4