summaryrefslogtreecommitdiffstats
path: root/docs/nspr/reference/pr_listen.rst
blob: 1b1efefc21995956a6c7b6df0055b51ef1533caf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
PR_Listen
=========

Listens for connections on a specified socket.


Syntax
------

.. code::

   #include <prio.h>

   PRStatus PR_Listen(
     PRFileDesc *fd,
     PRIntn backlog);


Parameters
~~~~~~~~~~

The function has the following parameters:

``fd``
   A pointer to a :ref:`PRFileDesc` object representing a socket that will
   be used to listen for new connections.
``backlog``
   The maximum length of the queue of pending connections.


Returns
~~~~~~~

The function returns one of the following values:

-  Upon successful completion of listen request, ``PR_SUCCESS``.
-  If unsuccessful, ``PR_FAILURE``. Further information can be obtained
   by calling :ref:`PR_GetError`.


Description
-----------

:ref:`PR_Listen` turns the specified socket into a rendezvous socket. It
creates a queue for pending connections and starts to listen for
connection requests on the socket. The maximum size of the queue for
pending connections is specified by the ``backlog`` parameter. Pending
connections may be accepted by calling :ref:`PR_Accept`.