summaryrefslogtreecommitdiffstats
path: root/docs/nspr/reference/pr_bind.rst
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /docs/nspr/reference/pr_bind.rst
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'docs/nspr/reference/pr_bind.rst')
-rw-r--r--docs/nspr/reference/pr_bind.rst54
1 files changed, 54 insertions, 0 deletions
diff --git a/docs/nspr/reference/pr_bind.rst b/docs/nspr/reference/pr_bind.rst
new file mode 100644
index 0000000000..25bba0bcd1
--- /dev/null
+++ b/docs/nspr/reference/pr_bind.rst
@@ -0,0 +1,54 @@
+PR_Bind
+=======
+
+Binds an address to a specified socket.
+
+
+Syntax
+------
+
+.. code::
+
+ #include <prio.h>
+
+ PRStatus PR_Bind(
+ PRFileDesc *fd,
+ const PRNetAddr *addr);
+
+
+Parameters
+~~~~~~~~~~
+
+The function has the following parameters:
+
+``fd``
+ A pointer to a :ref:`PRFileDesc` object representing a socket.
+``addr``
+ A pointer to a :ref:`PRNetAddr` object representing the address to which
+ the socket will be bound.
+
+
+Returns
+~~~~~~~
+
+The function returns one of the following values:
+
+- Upon successful binding of an address to a socket, ``PR_SUCCESS``.
+- If unsuccessful, ``PR_FAILURE``. Further information can be obtained
+ by calling :ref:`PR_GetError`.
+
+
+Description
+-----------
+
+When a new socket is created, it has no address bound to it. :ref:`PR_Bind`
+assigns the specified address (also known as name) to the socket. If you
+do not care about the exact IP address assigned to the socket, set the
+``inet.ip`` field of :ref:`PRNetAddr` to :ref:`PR_htonl`\ (``PR_INADDR_ANY``).
+If you do not care about the TCP/UDP port assigned to the socket, set
+the ``inet.port`` field of :ref:`PRNetAddr` to 0.
+
+Note that if :ref:`PR_Connect` is invoked on a socket that is not bound, it
+implicitly binds an arbitrary address the socket.
+
+Call :ref:`PR_GetSockName` to obtain the address (name) bound to a socket.