pr_send.rst (1124B)
1 PR_Send 2 ======= 3 4 Sends bytes from a connected socket. 5 6 7 Syntax 8 ------ 9 10 .. code:: 11 12 #include <prio.h> 13 14 PRInt32 PR_Send( 15 PRFileDesc *fd, 16 const 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 containing the data to be sent. 31 ``amount`` 32 The size of ``buf`` (in bytes). 33 ``flags`` 34 This obsolete parameter must always be zero. 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 successfully sent. If 46 the parameter fd is a blocking socket, this number must always equal 47 amount. 48 - The value -1 indicates a failure. The reason for the failure can be 49 obtained by calling :ref:`PR_GetError`. 50 51 52 Description 53 ----------- 54 55 :ref:`PR_Send` blocks until all bytes are sent, a timeout occurs, or an 56 error occurs.