diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2024-12-10 23:36:32 +0100 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2024-12-13 21:52:59 +0100 |
commit | e8969bff6cfebf950b2a52eabff53e53ff02ab0e (patch) | |
tree | 2129475b3a9082e9da228c127a7c811db81a1ec1 /docs/src | |
parent | 7b4cf04a914116d998c5ebcbf2d53b6848b2f65e (diff) | |
download | libuv-e8969bff6cfebf950b2a52eabff53e53ff02ab0e.tar.gz libuv-e8969bff6cfebf950b2a52eabff53e53ff02ab0e.zip |
unix,win: add uv_udp_try_send2
Add a version of uv_udp_try_send that can send multiple datagrams.
Uses sendmmsg(2) on platforms that support it (Linux, FreeBSD, macOS),
falls back to a regular sendmsg(2) loop elsewhere.
This work was sponsored by ISC, the Internet Systems Consortium.
Diffstat (limited to 'docs/src')
-rw-r--r-- | docs/src/udp.rst | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/docs/src/udp.rst b/docs/src/udp.rst index 31f7f7fd..5f225e5c 100644 --- a/docs/src/udp.rst +++ b/docs/src/udp.rst @@ -426,6 +426,20 @@ API .. versionchanged:: 1.27.0 added support for connected sockets +.. c:function:: int uv_udp_try_send2(uv_udp_t* handle, unsigned int count, uv_buf_t* bufs[/*count*/], unsigned int nbufs[/*count*/], struct sockaddr* addrs[/*count*/], unsigned int flags) + + Like :c:func:`uv_udp_try_send`, but can send multiple datagrams. + Lightweight abstraction around :man:`sendmmsg(2)`, with a :man:`sendmsg(2)` + fallback loop for platforms that do not support the former. The handle must + be fully initialized; call c:func:`uv_udp_bind` first. + + :returns: >= 0: number of datagrams sent. Zero only if `count` was zero. + < 0: negative error code. Only if sending the first datagram fails, + otherwise returns a positive send count. ``UV_EAGAIN`` when datagrams + cannot be sent right now; fall back to :c:func:`uv_udp_send`. + + .. versionadded:: 1.50.0 + .. c:function:: int uv_udp_recv_start(uv_udp_t* handle, uv_alloc_cb alloc_cb, uv_udp_recv_cb recv_cb) Prepare for receiving data. If the socket has not previously been bound |