tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

pr_recv.rst (1151B)


      1 PR_Recv
      2 =======
      3 
      4 Receives bytes from a connected socket.
      5 
      6 
      7 Syntax
      8 ------
      9 
     10 .. code::
     11 
     12   #include <prio.h>
     13 
     14   PRInt32 PR_Recv(
     15     PRFileDesc *fd,
     16     void *buf,
     17     PRInt32 amount,
     18     PRIntn flags,
     19     PRIntervalTime timeout);
     20 
     21 
     22 Parameters
     23 ~~~~~~~~~~
     24 
     25 The function has the following parameters:
     26 
     27 ``fd``
     28   A pointer to a :ref:`PRFileDesc` object representing a socket.
     29 ``buf``
     30   A pointer to a buffer to hold the data received.
     31 ``amount``
     32   The size of ``buf`` (in bytes).
     33 ``flags``
     34   Must be zero or ``PR_MSG_PEEK``.
     35 ``timeout``
     36   A value of type :ref:`PRIntervalTime` specifying the time limit for
     37   completion of the receive operation.
     38 
     39 
     40 Returns
     41 ~~~~~~~
     42 
     43 The function returns one of the following values:
     44 
     45 -  A positive number indicates the number of bytes actually received.
     46 -  The value 0 means the network connection is closed.
     47 -  The value -1 indicates a failure. The reason for the failure can be
     48   obtained by calling :ref:`PR_GetError`.
     49 
     50 
     51 Description
     52 -----------
     53 
     54 :ref:`PR_Recv` blocks until some positive number of bytes are transferred,
     55 a timeout occurs, or an error occurs. No more than ``amount`` bytes will
     56 be transferred.