Blame docs/src/udp.rst

Packit Service 7c31a4
Packit Service 7c31a4
.. _udp:
Packit Service 7c31a4
Packit Service 7c31a4
:c:type:`uv_udp_t` --- UDP handle
Packit Service 7c31a4
=================================
Packit Service 7c31a4
Packit Service 7c31a4
UDP handles encapsulate UDP communication for both clients and servers.
Packit Service 7c31a4
Packit Service 7c31a4
Packit Service 7c31a4
Data types
Packit Service 7c31a4
----------
Packit Service 7c31a4
Packit Service 7c31a4
.. c:type:: uv_udp_t
Packit Service 7c31a4
Packit Service 7c31a4
    UDP handle type.
Packit Service 7c31a4
Packit Service 7c31a4
.. c:type:: uv_udp_send_t
Packit Service 7c31a4
Packit Service 7c31a4
    UDP send request type.
Packit Service 7c31a4
Packit Service 7c31a4
.. c:type:: uv_udp_flags
Packit Service 7c31a4
Packit Service 7c31a4
    Flags used in :c:func:`uv_udp_bind` and :c:type:`uv_udp_recv_cb`..
Packit Service 7c31a4
Packit Service 7c31a4
    ::
Packit Service 7c31a4
Packit Service 7c31a4
        enum uv_udp_flags {
Packit Service 7c31a4
            /* Disables dual stack mode. */
Packit Service 7c31a4
            UV_UDP_IPV6ONLY = 1,
Packit Service 7c31a4
            /*
Packit Service 7c31a4
            * Indicates message was truncated because read buffer was too small. The
Packit Service 7c31a4
            * remainder was discarded by the OS. Used in uv_udp_recv_cb.
Packit Service 7c31a4
            */
Packit Service 7c31a4
            UV_UDP_PARTIAL = 2,
Packit Service 7c31a4
            /*
Packit Service 7c31a4
            * Indicates if SO_REUSEADDR will be set when binding the handle in
Packit Service 7c31a4
            * uv_udp_bind.
Packit Service 7c31a4
            * This sets the SO_REUSEPORT socket flag on the BSDs and OS X. On other
Packit Service 7c31a4
            * Unix platforms, it sets the SO_REUSEADDR flag. What that means is that
Packit Service 7c31a4
            * multiple threads or processes can bind to the same address without error
Packit Service 7c31a4
            * (provided they all set the flag) but only the last one to bind will receive
Packit Service 7c31a4
            * any traffic, in effect "stealing" the port from the previous listener.
Packit Service 7c31a4
            */
Packit Service 7c31a4
            UV_UDP_REUSEADDR = 4,
Packit Service 7c31a4
            /*
Packit Service 7c31a4
             * Indicates that the message was received by recvmmsg, so the buffer provided
Packit Service 7c31a4
             * must not be freed by the recv_cb callback.
Packit Service 7c31a4
             */
Packit Service 7c31a4
            UV_UDP_MMSG_CHUNK = 8,
Packit Service 7c31a4
            /*
Packit Service 7c31a4
            * Indicates that recvmmsg should be used, if available.
Packit Service 7c31a4
            */
Packit Service 7c31a4
            UV_UDP_RECVMMSG = 256
Packit Service 7c31a4
        };
Packit Service 7c31a4
Packit Service 7c31a4
.. c:type:: void (*uv_udp_send_cb)(uv_udp_send_t* req, int status)
Packit Service 7c31a4
Packit Service 7c31a4
    Type definition for callback passed to :c:func:`uv_udp_send`, which is
Packit Service 7c31a4
    called after the data was sent.
Packit Service 7c31a4
Packit Service 7c31a4
.. c:type:: void (*uv_udp_recv_cb)(uv_udp_t* handle, ssize_t nread, const uv_buf_t* buf, const struct sockaddr* addr, unsigned flags)
Packit Service 7c31a4
Packit Service 7c31a4
    Type definition for callback passed to :c:func:`uv_udp_recv_start`, which
Packit Service 7c31a4
    is called when the endpoint receives data.
Packit Service 7c31a4
Packit Service 7c31a4
    * `handle`: UDP handle
Packit Service 7c31a4
    * `nread`:  Number of bytes that have been received.
Packit Service 7c31a4
      0 if there is no more data to read. Note that 0 may also mean that an
Packit Service 7c31a4
      empty datagram was received (in this case `addr` is not NULL). < 0 if
Packit Service 7c31a4
      a transmission error was detected.
Packit Service 7c31a4
    * `buf`: :c:type:`uv_buf_t` with the received data.
Packit Service 7c31a4
    * `addr`: ``struct sockaddr*`` containing the address of the sender.
Packit Service 7c31a4
      Can be NULL. Valid for the duration of the callback only.
Packit Service 7c31a4
    * `flags`: One or more or'ed UV_UDP_* constants.
Packit Service 7c31a4
Packit Service 7c31a4
    The callee is responsible for freeing the buffer, libuv does not reuse it.
Packit Service 7c31a4
    The buffer may be a null buffer (where `buf->base` == NULL and `buf->len` == 0)
Packit Service 7c31a4
    on error.
Packit Service 7c31a4
Packit Service 7c31a4
    When using :man:`recvmmsg(2)`, chunks will have the `UV_UDP_MMSG_CHUNK` flag set,
Packit Service 7c31a4
    those must not be freed. There will be a final callback with `nread` set to 0,
Packit Service 7c31a4
    `addr` set to NULL and the buffer pointing at the initially allocated data with
Packit Service 7c31a4
    the `UV_UDP_MMSG_CHUNK` flag cleared. This is a good chance for the callee to
Packit Service 7c31a4
    free the provided buffer.
Packit Service 7c31a4
Packit Service 7c31a4
    .. note::
Packit Service 7c31a4
        The receive callback will be called with `nread` == 0 and `addr` == NULL when there is
Packit Service 7c31a4
        nothing to read, and with `nread` == 0 and `addr` != NULL when an empty UDP packet is
Packit Service 7c31a4
        received.
Packit Service 7c31a4
Packit Service 7c31a4
.. c:type:: uv_membership
Packit Service 7c31a4
Packit Service 7c31a4
    Membership type for a multicast address.
Packit Service 7c31a4
Packit Service 7c31a4
    ::
Packit Service 7c31a4
Packit Service 7c31a4
        typedef enum {
Packit Service 7c31a4
            UV_LEAVE_GROUP = 0,
Packit Service 7c31a4
            UV_JOIN_GROUP
Packit Service 7c31a4
        } uv_membership;
Packit Service 7c31a4
Packit Service 7c31a4
Packit Service 7c31a4
Public members
Packit Service 7c31a4
^^^^^^^^^^^^^^
Packit Service 7c31a4
Packit Service 7c31a4
.. c:member:: size_t uv_udp_t.send_queue_size
Packit Service 7c31a4
Packit Service 7c31a4
    Number of bytes queued for sending. This field strictly shows how much
Packit Service 7c31a4
    information is currently queued.
Packit Service 7c31a4
Packit Service 7c31a4
.. c:member:: size_t uv_udp_t.send_queue_count
Packit Service 7c31a4
Packit Service 7c31a4
    Number of send requests currently in the queue awaiting to be processed.
Packit Service 7c31a4
Packit Service 7c31a4
.. c:member:: uv_udp_t* uv_udp_send_t.handle
Packit Service 7c31a4
Packit Service 7c31a4
    UDP handle where this send request is taking place.
Packit Service 7c31a4
Packit Service 7c31a4
.. seealso:: The :c:type:`uv_handle_t` members also apply.
Packit Service 7c31a4
Packit Service 7c31a4
Packit Service 7c31a4
API
Packit Service 7c31a4
---
Packit Service 7c31a4
Packit Service 7c31a4
.. c:function:: int uv_udp_init(uv_loop_t* loop, uv_udp_t* handle)
Packit Service 7c31a4
Packit Service 7c31a4
    Initialize a new UDP handle. The actual socket is created lazily.
Packit Service 7c31a4
    Returns 0 on success.
Packit Service 7c31a4
Packit Service 7c31a4
.. c:function:: int uv_udp_init_ex(uv_loop_t* loop, uv_udp_t* handle, unsigned int flags)
Packit Service 7c31a4
Packit Service 7c31a4
    Initialize the handle with the specified flags. The lower 8 bits of the `flags`
Packit Service 7c31a4
    parameter are used as the socket domain. A socket will be created for the given domain.
Packit Service 7c31a4
    If the specified domain is ``AF_UNSPEC`` no socket is created, just like :c:func:`uv_udp_init`.
Packit Service 7c31a4
Packit Service 7c31a4
    The remaining bits can be used to set one of these flags:
Packit Service 7c31a4
Packit Service 7c31a4
    * `UV_UDP_RECVMMSG`: if set, and the platform supports it, :man:`recvmmsg(2)` will
Packit Service 7c31a4
      be used.
Packit Service 7c31a4
Packit Service 7c31a4
    .. versionadded:: 1.7.0
Packit Service 7c31a4
    .. versionchanged:: 1.37.0 added the `UV_UDP_RECVMMSG` flag.
Packit Service 7c31a4
Packit Service 7c31a4
.. c:function:: int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock)
Packit Service 7c31a4
Packit Service 7c31a4
    Opens an existing file descriptor or Windows SOCKET as a UDP handle.
Packit Service 7c31a4
Packit Service 7c31a4
    Unix only:
Packit Service 7c31a4
    The only requirement of the `sock` argument is that it follows the datagram
Packit Service 7c31a4
    contract (works in unconnected mode, supports sendmsg()/recvmsg(), etc).
Packit Service 7c31a4
    In other words, other datagram-type sockets like raw sockets or netlink
Packit Service 7c31a4
    sockets can also be passed to this function.
Packit Service 7c31a4
Packit Service 7c31a4
    .. versionchanged:: 1.2.1 the file descriptor is set to non-blocking mode.
Packit Service 7c31a4
Packit Service 7c31a4
    .. note::
Packit Service 7c31a4
        The passed file descriptor or SOCKET is not checked for its type, but
Packit Service 7c31a4
        it's required that it represents a valid datagram socket.
Packit Service 7c31a4
Packit Service 7c31a4
.. c:function:: int uv_udp_bind(uv_udp_t* handle, const struct sockaddr* addr, unsigned int flags)
Packit Service 7c31a4
Packit Service 7c31a4
    Bind the UDP handle to an IP address and port.
Packit Service 7c31a4
Packit Service 7c31a4
    :param handle: UDP handle. Should have been initialized with
Packit Service 7c31a4
        :c:func:`uv_udp_init`.
Packit Service 7c31a4
Packit Service 7c31a4
    :param addr: `struct sockaddr_in` or `struct sockaddr_in6`
Packit Service 7c31a4
        with the address and port to bind to.
Packit Service 7c31a4
Packit Service 7c31a4
    :param flags: Indicate how the socket will be bound,
Packit Service 7c31a4
        ``UV_UDP_IPV6ONLY`` and ``UV_UDP_REUSEADDR`` are supported.
Packit Service 7c31a4
Packit Service 7c31a4
    :returns: 0 on success, or an error code < 0 on failure.
Packit Service 7c31a4
Packit Service 7c31a4
.. c:function:: int uv_udp_connect(uv_udp_t* handle, const struct sockaddr* addr)
Packit Service 7c31a4
Packit Service 7c31a4
    Associate the UDP handle to a remote address and port, so every
Packit Service 7c31a4
    message sent by this handle is automatically sent to that destination.
Packit Service 7c31a4
    Calling this function with a `NULL` `addr` disconnects the handle.
Packit Service 7c31a4
    Trying to call `uv_udp_connect()` on an already connected handle will result
Packit Service 7c31a4
    in an `UV_EISCONN` error. Trying to disconnect a handle that is not
Packit Service 7c31a4
    connected will return an `UV_ENOTCONN` error.
Packit Service 7c31a4
Packit Service 7c31a4
    :param handle: UDP handle. Should have been initialized with
Packit Service 7c31a4
        :c:func:`uv_udp_init`.
Packit Service 7c31a4
Packit Service 7c31a4
    :param addr: `struct sockaddr_in` or `struct sockaddr_in6`
Packit Service 7c31a4
        with the address and port to associate to.
Packit Service 7c31a4
Packit Service 7c31a4
    :returns: 0 on success, or an error code < 0 on failure.
Packit Service 7c31a4
Packit Service 7c31a4
    .. versionadded:: 1.27.0
Packit Service 7c31a4
Packit Service 7c31a4
.. c:function:: int uv_udp_getpeername(const uv_udp_t* handle, struct sockaddr* name, int* namelen)
Packit Service 7c31a4
Packit Service 7c31a4
    Get the remote IP and port of the UDP handle on connected UDP handles.
Packit Service 7c31a4
    On unconnected handles, it returns `UV_ENOTCONN`.
Packit Service 7c31a4
Packit Service 7c31a4
    :param handle: UDP handle. Should have been initialized with
Packit Service 7c31a4
        :c:func:`uv_udp_init` and bound.
Packit Service 7c31a4
Packit Service 7c31a4
    :param name: Pointer to the structure to be filled with the address data.
Packit Service 7c31a4
        In order to support IPv4 and IPv6 `struct sockaddr_storage` should be
Packit Service 7c31a4
        used.
Packit Service 7c31a4
Packit Service 7c31a4
    :param namelen: On input it indicates the data of the `name` field. On
Packit Service 7c31a4
        output it indicates how much of it was filled.
Packit Service 7c31a4
Packit Service 7c31a4
    :returns: 0 on success, or an error code < 0 on failure
Packit Service 7c31a4
Packit Service 7c31a4
    .. versionadded:: 1.27.0
Packit Service 7c31a4
Packit Service 7c31a4
.. c:function:: int uv_udp_getsockname(const uv_udp_t* handle, struct sockaddr* name, int* namelen)
Packit Service 7c31a4
Packit Service 7c31a4
    Get the local IP and port of the UDP handle.
Packit Service 7c31a4
Packit Service 7c31a4
    :param handle: UDP handle. Should have been initialized with
Packit Service 7c31a4
        :c:func:`uv_udp_init` and bound.
Packit Service 7c31a4
Packit Service 7c31a4
    :param name: Pointer to the structure to be filled with the address data.
Packit Service 7c31a4
        In order to support IPv4 and IPv6 `struct sockaddr_storage` should be
Packit Service 7c31a4
        used.
Packit Service 7c31a4
Packit Service 7c31a4
    :param namelen: On input it indicates the data of the `name` field. On
Packit Service 7c31a4
        output it indicates how much of it was filled.
Packit Service 7c31a4
Packit Service 7c31a4
    :returns: 0 on success, or an error code < 0 on failure.
Packit Service 7c31a4
Packit Service 7c31a4
.. c:function:: int uv_udp_set_membership(uv_udp_t* handle, const char* multicast_addr, const char* interface_addr, uv_membership membership)
Packit Service 7c31a4
Packit Service 7c31a4
    Set membership for a multicast address
Packit Service 7c31a4
Packit Service 7c31a4
    :param handle: UDP handle. Should have been initialized with
Packit Service 7c31a4
        :c:func:`uv_udp_init`.
Packit Service 7c31a4
Packit Service 7c31a4
    :param multicast_addr: Multicast address to set membership for.
Packit Service 7c31a4
Packit Service 7c31a4
    :param interface_addr: Interface address.
Packit Service 7c31a4
Packit Service 7c31a4
    :param membership: Should be ``UV_JOIN_GROUP`` or ``UV_LEAVE_GROUP``.
Packit Service 7c31a4
Packit Service 7c31a4
    :returns: 0 on success, or an error code < 0 on failure.
Packit Service 7c31a4
Packit Service 7c31a4
.. c:function:: int uv_udp_set_source_membership(uv_udp_t* handle, const char* multicast_addr, const char* interface_addr, const char* source_addr, uv_membership membership)
Packit Service 7c31a4
Packit Service 7c31a4
    Set membership for a source-specific multicast group.
Packit Service 7c31a4
Packit Service 7c31a4
    :param handle: UDP handle. Should have been initialized with
Packit Service 7c31a4
        :c:func:`uv_udp_init`.
Packit Service 7c31a4
Packit Service 7c31a4
    :param multicast_addr: Multicast address to set membership for.
Packit Service 7c31a4
Packit Service 7c31a4
    :param interface_addr: Interface address.
Packit Service 7c31a4
Packit Service 7c31a4
    :param source_addr: Source address.
Packit Service 7c31a4
Packit Service 7c31a4
    :param membership: Should be ``UV_JOIN_GROUP`` or ``UV_LEAVE_GROUP``.
Packit Service 7c31a4
Packit Service 7c31a4
    :returns: 0 on success, or an error code < 0 on failure.
Packit Service 7c31a4
Packit Service 7c31a4
    .. versionadded:: 1.32.0
Packit Service 7c31a4
Packit Service 7c31a4
.. c:function:: int uv_udp_set_multicast_loop(uv_udp_t* handle, int on)
Packit Service 7c31a4
Packit Service 7c31a4
    Set IP multicast loop flag. Makes multicast packets loop back to
Packit Service 7c31a4
    local sockets.
Packit Service 7c31a4
Packit Service 7c31a4
    :param handle: UDP handle. Should have been initialized with
Packit Service 7c31a4
        :c:func:`uv_udp_init`.
Packit Service 7c31a4
Packit Service 7c31a4
    :param on: 1 for on, 0 for off.
Packit Service 7c31a4
Packit Service 7c31a4
    :returns: 0 on success, or an error code < 0 on failure.
Packit Service 7c31a4
Packit Service 7c31a4
.. c:function:: int uv_udp_set_multicast_ttl(uv_udp_t* handle, int ttl)
Packit Service 7c31a4
Packit Service 7c31a4
    Set the multicast ttl.
Packit Service 7c31a4
Packit Service 7c31a4
    :param handle: UDP handle. Should have been initialized with
Packit Service 7c31a4
        :c:func:`uv_udp_init`.
Packit Service 7c31a4
Packit Service 7c31a4
    :param ttl: 1 through 255.
Packit Service 7c31a4
Packit Service 7c31a4
    :returns: 0 on success, or an error code < 0 on failure.
Packit Service 7c31a4
Packit Service 7c31a4
.. c:function:: int uv_udp_set_multicast_interface(uv_udp_t* handle, const char* interface_addr)
Packit Service 7c31a4
Packit Service 7c31a4
    Set the multicast interface to send or receive data on.
Packit Service 7c31a4
Packit Service 7c31a4
    :param handle: UDP handle. Should have been initialized with
Packit Service 7c31a4
        :c:func:`uv_udp_init`.
Packit Service 7c31a4
Packit Service 7c31a4
    :param interface_addr: interface address.
Packit Service 7c31a4
Packit Service 7c31a4
    :returns: 0 on success, or an error code < 0 on failure.
Packit Service 7c31a4
Packit Service 7c31a4
.. c:function:: int uv_udp_set_broadcast(uv_udp_t* handle, int on)
Packit Service 7c31a4
Packit Service 7c31a4
    Set broadcast on or off.
Packit Service 7c31a4
Packit Service 7c31a4
    :param handle: UDP handle. Should have been initialized with
Packit Service 7c31a4
        :c:func:`uv_udp_init`.
Packit Service 7c31a4
Packit Service 7c31a4
    :param on: 1 for on, 0 for off.
Packit Service 7c31a4
Packit Service 7c31a4
    :returns: 0 on success, or an error code < 0 on failure.
Packit Service 7c31a4
Packit Service 7c31a4
.. c:function:: int uv_udp_set_ttl(uv_udp_t* handle, int ttl)
Packit Service 7c31a4
Packit Service 7c31a4
    Set the time to live.
Packit Service 7c31a4
Packit Service 7c31a4
    :param handle: UDP handle. Should have been initialized with
Packit Service 7c31a4
        :c:func:`uv_udp_init`.
Packit Service 7c31a4
Packit Service 7c31a4
    :param ttl: 1 through 255.
Packit Service 7c31a4
Packit Service 7c31a4
    :returns: 0 on success, or an error code < 0 on failure.
Packit Service 7c31a4
Packit Service 7c31a4
.. c:function:: int uv_udp_send(uv_udp_send_t* req, uv_udp_t* handle, const uv_buf_t bufs[], unsigned int nbufs, const struct sockaddr* addr, uv_udp_send_cb send_cb)
Packit Service 7c31a4
Packit Service 7c31a4
    Send data over the UDP socket. If the socket has not previously been bound
Packit Service 7c31a4
    with :c:func:`uv_udp_bind` it will be bound to 0.0.0.0
Packit Service 7c31a4
    (the "all interfaces" IPv4 address) and a random port number.
Packit Service 7c31a4
Packit Service 7c31a4
    On Windows if the `addr` is initialized to point to an unspecified address
Packit Service 7c31a4
    (``0.0.0.0`` or ``::``) it will be changed to point to ``localhost``.
Packit Service 7c31a4
    This is done to match the behavior of Linux systems.
Packit Service 7c31a4
Packit Service 7c31a4
    For connected UDP handles, `addr` must be set to `NULL`, otherwise it will
Packit Service 7c31a4
    return `UV_EISCONN` error.
Packit Service 7c31a4
Packit Service 7c31a4
    For connectionless UDP handles, `addr` cannot be `NULL`, otherwise it will
Packit Service 7c31a4
    return `UV_EDESTADDRREQ` error.
Packit Service 7c31a4
Packit Service 7c31a4
    :param req: UDP request handle. Need not be initialized.
Packit Service 7c31a4
Packit Service 7c31a4
    :param handle: UDP handle. Should have been initialized with
Packit Service 7c31a4
        :c:func:`uv_udp_init`.
Packit Service 7c31a4
Packit Service 7c31a4
    :param bufs: List of buffers to send.
Packit Service 7c31a4
Packit Service 7c31a4
    :param nbufs: Number of buffers in `bufs`.
Packit Service 7c31a4
Packit Service 7c31a4
    :param addr: `struct sockaddr_in` or `struct sockaddr_in6` with the
Packit Service 7c31a4
        address and port of the remote peer.
Packit Service 7c31a4
Packit Service 7c31a4
    :param send_cb: Callback to invoke when the data has been sent out.
Packit Service 7c31a4
Packit Service 7c31a4
    :returns: 0 on success, or an error code < 0 on failure.
Packit Service 7c31a4
Packit Service 7c31a4
    .. versionchanged:: 1.19.0 added ``0.0.0.0`` and ``::`` to ``localhost``
Packit Service 7c31a4
        mapping
Packit Service 7c31a4
Packit Service 7c31a4
    .. versionchanged:: 1.27.0 added support for connected sockets
Packit Service 7c31a4
Packit Service 7c31a4
.. c:function:: int uv_udp_try_send(uv_udp_t* handle, const uv_buf_t bufs[], unsigned int nbufs, const struct sockaddr* addr)
Packit Service 7c31a4
Packit Service 7c31a4
    Same as :c:func:`uv_udp_send`, but won't queue a send request if it can't
Packit Service 7c31a4
    be completed immediately.
Packit Service 7c31a4
Packit Service 7c31a4
    For connected UDP handles, `addr` must be set to `NULL`, otherwise it will
Packit Service 7c31a4
    return `UV_EISCONN` error.
Packit Service 7c31a4
Packit Service 7c31a4
    For connectionless UDP handles, `addr` cannot be `NULL`, otherwise it will
Packit Service 7c31a4
    return `UV_EDESTADDRREQ` error.
Packit Service 7c31a4
Packit Service 7c31a4
    :returns: >= 0: number of bytes sent (it matches the given buffer size).
Packit Service 7c31a4
        < 0: negative error code (``UV_EAGAIN`` is returned when the message
Packit Service 7c31a4
        can't be sent immediately).
Packit Service 7c31a4
Packit Service 7c31a4
    .. versionchanged:: 1.27.0 added support for connected sockets
Packit Service 7c31a4
Packit Service 7c31a4
.. c:function:: int uv_udp_recv_start(uv_udp_t* handle, uv_alloc_cb alloc_cb, uv_udp_recv_cb recv_cb)
Packit Service 7c31a4
Packit Service 7c31a4
    Prepare for receiving data. If the socket has not previously been bound
Packit Service 7c31a4
    with :c:func:`uv_udp_bind` it is bound to 0.0.0.0 (the "all interfaces"
Packit Service 7c31a4
    IPv4 address) and a random port number.
Packit Service 7c31a4
Packit Service 7c31a4
    :param handle: UDP handle. Should have been initialized with
Packit Service 7c31a4
        :c:func:`uv_udp_init`.
Packit Service 7c31a4
Packit Service 7c31a4
    :param alloc_cb: Callback to invoke when temporary storage is needed.
Packit Service 7c31a4
Packit Service 7c31a4
    :param recv_cb: Callback to invoke with received data.
Packit Service 7c31a4
Packit Service 7c31a4
    :returns: 0 on success, or an error code < 0 on failure.
Packit Service 7c31a4
Packit Service 7c31a4
    .. versionchanged:: 1.35.0 added support for :man:`recvmmsg(2)` on supported platforms).
Packit Service 7c31a4
                        The use of this feature requires a buffer larger than
Packit Service 7c31a4
                        2 * 64KB to be passed to `alloc_cb`.
Packit Service 7c31a4
    .. versionchanged:: 1.37.0 :man:`recvmmsg(2)` support is no longer enabled implicitly,
Packit Service 7c31a4
                        it must be explicitly requested by passing the `UV_UDP_RECVMMSG` flag to
Packit Service 7c31a4
                        :c:func:`uv_udp_init_ex`.
Packit Service 7c31a4
Packit Service 7c31a4
.. c:function:: int uv_udp_recv_stop(uv_udp_t* handle)
Packit Service 7c31a4
Packit Service 7c31a4
    Stop listening for incoming datagrams.
Packit Service 7c31a4
Packit Service 7c31a4
    :param handle: UDP handle. Should have been initialized with
Packit Service 7c31a4
        :c:func:`uv_udp_init`.
Packit Service 7c31a4
Packit Service 7c31a4
    :returns: 0 on success, or an error code < 0 on failure.
Packit Service 7c31a4
Packit Service 7c31a4
.. c:function:: size_t uv_udp_get_send_queue_size(const uv_udp_t* handle)
Packit Service 7c31a4
Packit Service 7c31a4
    Returns `handle->send_queue_size`.
Packit Service 7c31a4
Packit Service 7c31a4
    .. versionadded:: 1.19.0
Packit Service 7c31a4
Packit Service 7c31a4
.. c:function:: size_t uv_udp_get_send_queue_count(const uv_udp_t* handle)
Packit Service 7c31a4
Packit Service 7c31a4
    Returns `handle->send_queue_count`.
Packit Service 7c31a4
Packit Service 7c31a4
    .. versionadded:: 1.19.0
Packit Service 7c31a4
Packit Service 7c31a4
.. seealso:: The :c:type:`uv_handle_t` API functions also apply.