1#ifndef NEFORCE_NETWORK_IP_SOCKET_HPP__
2#define NEFORCE_NETWORK_IP_SOCKET_HPP__
13NEFORCE_BEGIN_NAMESPACE__
53 NEFORCE_NODISCARD
uint8_t ihl() const noexcept {
return version_ihl & 0x0F; }
112 NEFORCE_NODISCARD
bool is_ipv4() const noexcept {
return family_ == family::INET4; }
118 NEFORCE_NODISCARD
bool is_ipv6() const noexcept {
return family_ == family::INET6; }
145NEFORCE_END_NAMESPACE__
family address_family() const noexcept
获取地址族
bool is_ipv4() const noexcept
检查是否为IPv4 socket
virtual void connect(const ip_address &endpoint)
连接到远程端点(TCP客户端)
ip_socket()=default
默认构造函数
ip_socket(const native_handle_type fd) noexcept
从原生句柄构造
bool is_ipv6() const noexcept
检查是否为IPv6 socket
bool close() noexcept override
关闭socket
uintptr_t native_handle_type
平台原生句柄类型
virtual bool close() noexcept
关闭socket
ip_address::family family
网络地址族类型
unsigned int uint32_t
32位无符号整数类型
unsigned char uint8_t
8位无符号整数类型
unsigned short uint16_t
16位无符号整数类型