tor-browser

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

pr_newudpsocket.rst (1145B)


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