net/SocketDescriptor: add Send()/Receive() overloads with iovec
This commit is contained in:

committed by
Max Kellermann

parent
974ed0166c
commit
6f6cbeba80
@@ -6,6 +6,7 @@
|
||||
#include "StaticSocketAddress.hxx"
|
||||
#include "IPv4Address.hxx"
|
||||
#include "IPv6Address.hxx"
|
||||
#include "MsgHdr.hxx"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <ws2tcpip.h>
|
||||
@@ -423,6 +424,13 @@ SocketDescriptor::Receive(struct msghdr &msg, int flags) const noexcept
|
||||
return ::recvmsg(Get(), &msg, flags);
|
||||
}
|
||||
|
||||
ssize_t
|
||||
SocketDescriptor::Receive(std::span<const struct iovec> v, int flags) const noexcept
|
||||
{
|
||||
auto msg = MakeMsgHdr(v);
|
||||
return Receive(msg, flags);
|
||||
}
|
||||
|
||||
ssize_t
|
||||
SocketDescriptor::Send(std::span<const std::byte> src, int flags) const noexcept
|
||||
{
|
||||
@@ -443,6 +451,12 @@ SocketDescriptor::Send(const struct msghdr &msg, int flags) const noexcept
|
||||
return ::sendmsg(Get(), &msg, flags);
|
||||
}
|
||||
|
||||
ssize_t
|
||||
SocketDescriptor::Send(std::span<const struct iovec> v, int flags) const noexcept
|
||||
{
|
||||
return Send(MakeMsgHdr(v), flags);
|
||||
}
|
||||
|
||||
ssize_t
|
||||
SocketDescriptor::ReadNoWait(std::span<std::byte> dest) const noexcept
|
||||
{
|
||||
|
Reference in New Issue
Block a user