21#ifndef IO_SOCKET_HANDLE_HPP
22#define IO_SOCKET_HANDLE_HPP
23#include "detail/socket.hpp"
31auto is_valid_socket(native_socket_type handle) -> bool;
85 explicit operator native_socket_type() const noexcept;
95 [[nodiscard]] explicit operator
bool() const noexcept;
101 -> std::strong_ordering;
112 operator<=>(native_socket_type other) const noexcept -> std::strong_ordering;
117 auto operator==(native_socket_type other) const noexcept ->
bool;
122 auto set_error(
int error) noexcept ->
void;
127 auto get_error() const noexcept -> std::error_code;
138 auto close() noexcept ->
void;
143 std::atomic<native_socket_type> socket_{INVALID_SOCKET};
147 std::atomic<int> error_;
151 mutable std::mutex mtx_;
156#include "detail/sync_operations.hpp"
157#include "impl/socket_handle_impl.hpp"
A thread-safe, move-only RAII wrapper for a native socket handle.
Definition socket_handle.hpp:42
socket_handle(socket_handle &&other) noexcept
Move constructor.
auto operator=(socket_handle &&other) noexcept -> socket_handle &
Move assignment.
socket_handle(native_socket_type handle)
Constructs from a native socket handle.
socket_handle()=default
Initializes an invalid socket handle.
socket_handle(int domain, int type, int protocol)
Constructs a new socket.
The io::socket namespace provides a cross-platform abstraction for socket-level I/O operations.
Definition poll_multiplexer.hpp:36