pr_openudpsocket.rst (1212B)
1 PR_OpenUDPSocket 2 ================ 3 4 Creates a new UDP socket of the specified address family. 5 6 7 Syntax 8 ------ 9 10 .. code:: 11 12 #include <prio.h> 13 14 PRFileDesc* PR_OpenUDPSocket(PRIntn af); 15 16 17 Parameters 18 ~~~~~~~~~~ 19 20 The function has the following parameters: 21 22 ``af`` 23 The address family of the new UDP socket. Can be ``PR_AF_INET`` 24 (IPv4), ``PR_AF_INET6`` (IPv6), or ``PR_AF_LOCAL`` (Unix domain, 25 supported on POSIX systems only). 26 27 28 Returns 29 ~~~~~~~ 30 31 The function returns one of the following values: 32 33 - Upon successful completion, a pointer to the :ref:`PRFileDesc` object 34 created for the newly opened UDP socket. 35 - If the creation of a new UDP socket failed, ``NULL``. 36 37 38 Description 39 ----------- 40 41 UDP (User Datagram Protocol) is a connectionless, unreliable datagram 42 protocol of the TCP/IP protocol suite. UDP datagrams may be lost or 43 delivered in duplicates or out of sequence. 44 45 :ref:`PR_OpenUDPSocket` creates a new UDP socket of the address family 46 ``af``. The socket may be bound to a well-known port number with 47 :ref:`PR_Bind`. Datagrams can be sent with :ref:`PR_SendTo` and received with 48 :ref:`PR_RecvFrom`. When the socket is no longer needed, it should be 49 closed with a call to :ref:`PR_Close`.