25 "size must be between 0 and sizeof(sockaddr_storage_type)");
30 assert(addr !=
nullptr &&
"addr must not be nullptr.");
32 "size must be between 0 and sizeof(sockaddr_storage_type)");
33 std::memcpy(&storage_, addr, size_);
54 if (size_ != other.size_)
56 return std::memcmp(&storage_, &other.storage_, size_) == 0;
A platform-independent representation of a socket address.
auto data() noexcept -> sockaddr_type *
Returns a mutable pointer to the underlying socket address data.
auto size() noexcept -> socklen_type *
Returns a mutable pointer to the size of the socket address.
socket_address()=default
Constructs an empty socket address.
auto operator==(const socket_address &other) const noexcept -> bool
Compares two socket_address objects for equality.
The io::socket namespace provides a cross-platform abstraction for socket-level I/O operations.
sockaddr sockaddr_type
The generic socket address structure 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.
This file defines the socket_address class, a platform-independent abstraction for socket addresses.