diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /docs/nspr/reference/pr_acceptread.rst | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'docs/nspr/reference/pr_acceptread.rst')
-rw-r--r-- | docs/nspr/reference/pr_acceptread.rst | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/docs/nspr/reference/pr_acceptread.rst b/docs/nspr/reference/pr_acceptread.rst new file mode 100644 index 0000000000..d0e8fca61b --- /dev/null +++ b/docs/nspr/reference/pr_acceptread.rst @@ -0,0 +1,73 @@ +PR_AcceptRead +============= + +Accepts a new connection and receives a block of data. + + +Syntax +------ + +.. code:: + + #include <prio.h> + + PRInt32 PR_AcceptRead( + PRFileDesc *listenSock, + PRFileDesc **acceptedSock, + PRNetAddr **peerAddr, + void *buf, + PRInt32 amount, + PRIntervalTime timeout); + + +Parameters +~~~~~~~~~~ + +The function has the following parameters: + +``listenSock`` + A pointer to a :ref:`PRFileDesc` object representing a socket descriptor + that has been called with the :ref:`PR_Listen` function, also known as + the rendezvous socket. +``acceptedSock`` + A pointer to a pointer to a :ref:`PRFileDesc` object. On return, + ``*acceptedSock`` points to the :ref:`PRFileDesc` object for the newly + connected socket. This parameter is valid only if the function return + does not indicate failure. +``peerAddr`` + A pointer a pointer to a :ref:`PRNetAddr` object. On return, + ``peerAddr`` points to the address of the remote socket. The + :ref:`PRNetAddr` object that ``peerAddr`` points to will be in the + buffer pointed to by ``buf``. This parameter is valid only if the + function return does not indicate failure. +``buf`` + A pointer to a buffer to hold data sent by the peer and the peer's + address. This buffer must be large enough to receive ``amount`` bytes + of data and two :ref:`PRNetAddr` structures (thus allowing the runtime + to align the addresses as needed). +``amount`` + The number of bytes of data to receive. Does not include the size of + the :ref:`PRNetAddr` structures. If 0, no data will be read from the + peer. +``timeout`` + The timeout interval only applies to the read portion of the + operation. :ref:`PR_AcceptRead` blocks indefinitely until the connection + is accepted; the read will time out after the timeout interval + elapses. + + +Returns +~~~~~~~ + +- A positive number indicates the number of bytes read from the peer. +- The value -1 indicates a failure. The reason for the failure can be + obtained by calling :ref:`PR_GetError`. + + +Description +----------- + +:ref:`PR_AcceptRead` accepts a new connection and retrieves the newly +created socket's descriptor and the connecting peer's address. Also, as +its name suggests, :ref:`PR_AcceptRead` receives the first block of data +sent by the peer. |