io
C++ I/O scheduling library with asynchronous socket operations
Loading...
Searching...
No Matches
Namespaces | Macros | Typedefs | Functions
socket.hpp File Reference

This file contains the POSIX-specific socket definitions and functions. More...

#include <ios>
#include <span>
#include <fcntl.h>
#include <sys/socket.h>
#include <unistd.h>

Go to the source code of this file.

Namespaces

namespace  io
 The io namespace contains all the functions and classes for the I/O library.
 
namespace  io::socket
 The io::socket namespace provides a cross-platform abstraction for socket-level I/O operations.
 

Typedefs

using io::socket::native_socket_type = int
 The native socket handle type for POSIX systems.
 
using io::socket::socket_buffer_type = std::span< char, std::dynamic_extent >
 The socket buffer type for POSIX systems.
 
using io::socket::socket_message_type = msghdr
 The socket message type for POSIX systems.
 
using io::socket::sockaddr_type = sockaddr
 The generic socket address structure for POSIX systems.
 
using io::socket::sockaddr_storage_type = sockaddr_storage
 The socket address storage structure for POSIX systems.
 
using io::socket::socklen_type = socklen_t
 The type used to represent socket-related sizes on POSIX systems.
 

Functions

auto io::socket::close (native_socket_type socket) noexcept -> int
 Closes a socket descriptor on POSIX systems.
 
template<typename... Args>
auto io::socket::fcntl (native_socket_type socket, int cmd, Args &&...args) noexcept -> int
 Provides a C++ wrapper for the POSIX fcntl function.
 
auto io::socket::sendmsg (native_socket_type socket, const socket_message_type *msg, int flags) noexcept -> std::streamsize
 Sends a message on a socket.
 
auto io::socket::recvmsg (native_socket_type socket, socket_message_type *msg, int flags) noexcept -> std::streamsize
 Receives a message from a socket.
 

Detailed Description

This file contains the POSIX-specific socket definitions and functions.

Definition in file socket.hpp.

Macro Definition Documentation

◆ IO_SOCKET_POSIX_HPP

#define IO_SOCKET_POSIX_HPP

Definition at line 23 of file socket.hpp.