22#ifndef IO_SOCKET_POSIX_HPP
23#define IO_SOCKET_POSIX_HPP
28#include <sys/socket.h>
51inline static constexpr int SOCKET_ERROR = -1;
75 return ::close(socket);
91template <
typename... Args>
93 Args &&...args)
noexcept ->
int {
95 return ::fcntl(socket, cmd, std::forward<Args>(args)...);
110 int flags)
noexcept -> std::streamsize {
111 return ::sendmsg(socket, msg, flags);
126 int flags)
noexcept -> std::streamsize {
127 return ::recvmsg(socket, msg, flags);
The io::socket namespace provides a cross-platform abstraction for socket-level I/O operations.
msghdr socket_message_type
The socket message type for POSIX systems.
auto close(native_socket_type socket) noexcept -> int
Closes a socket descriptor on POSIX systems.
sockaddr sockaddr_type
The generic socket address structure for POSIX systems.
int native_socket_type
The native socket handle type for POSIX systems.
socklen_t socklen_type
The type used to represent socket-related sizes on POSIX systems.
sockaddr_storage sockaddr_storage_type
The socket address storage structure for POSIX systems.
std::span< char, std::dynamic_extent > socket_buffer_type
The socket buffer type for POSIX systems.
constexpr detail::cpo< socket::recvmsg_t > recvmsg
A customization point object that receives a message from a socket.
constexpr detail::cpo< socket::fcntl_t > fcntl
A customization point object that performs a file control operation on a socket.
constexpr detail::cpo< socket::sendmsg_t > sendmsg
A customization point object that sends a message on a socket.