tor-browser

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

pr_getconnectstatus.rst (1211B)


      1 PR_GetConnectStatus
      2 ===================
      3 
      4 Get the completion status of a nonblocking connection.
      5 
      6 
      7 Syntax
      8 ------
      9 
     10 .. code::
     11 
     12   PRStatus PR_GetConnectStatus(const PRPollDesc *pd);
     13 
     14 
     15 Parameter
     16 ~~~~~~~~~
     17 
     18 The function has the following parameter:
     19 
     20 ``pd``
     21   A pointer to a ``PRPollDesc`` satructure whose ``fd`` field is the
     22   socket and whose ``in_flags`` field must contain ``PR_POLL_WRITE``
     23   and ``PR_POLL_EXCEPT``.
     24 
     25 
     26 Returns
     27 ~~~~~~~
     28 
     29 The function returns one of these values:
     30 
     31 -  If successful, ``PR_SUCCESS``.
     32 -  If unsuccessful, ``PR_FAILURE``. The reason for the failure can be
     33   retrieved via :ref:`PR_GetError`.
     34 
     35 If :ref:`PR_GetError` returns ``PR_IN_PROGRESS_ERROR``, the nonblocking
     36 connection is still in progress and has not completed yet.Other errors
     37 indicate that the connection has failed.
     38 
     39 
     40 Description
     41 -----------
     42 
     43 After :ref:`PR_Connect` on a nonblocking socket fails with
     44 ``PR_IN_PROGRESS_ERROR``, you may wait for the connection to complete by
     45 calling :ref:`PR_Poll` on the socket with the ``in_flags``
     46 ``PR_POLL_WRITE`` \| ``PR_POLL_EXCEPT``. When :ref:`PR_Poll` returns, call
     47 :ref:`PR_GetConnectStatus` on the socket to determine whether the
     48 nonblocking connect has succeeded or failed.