rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.04k stars 12.68k forks source link

UnixDatagram: please support vectored send #68612

Open joshtriplett opened 4 years ago

joshtriplett commented 4 years ago

The UnixDatagram type provides send and send_to methods, but does not provide a vectored send operation. Such an operation is particularly helpful for datagrams, where separate send operations result in separate datagrams; a vectored send allows sending data from multiple buffers in a single datagram.

Given that UnixDatagram only runs on UNIX, where writev works just fine on a socket, such an operation could use writev; alternatively, this could use sendmsg, which supports supplying an iovec. sendmsg would also allow a vectored send_to operation.

sfackler commented 4 years ago

We don't support vectored send/recv on UdpSocket either currently - PRs welcome for both!

joshtriplett commented 4 years ago

@sfackler Makes sense; UdpSocket filed separately as https://github.com/rust-lang/rust/issues/68617.

contrun commented 4 years ago

I have just added vectored send for send in https://github.com/rust-lang/rust/pull/69915 . It seems that we don't have binding for sendmsg from libc.