|
| TCPSocket ()=default |
|
auto | Domain () const -> SockDomain |
| 返回 socket 域。更多...
|
|
bool | IsClosed () const |
|
Result | GetSockError () const |
| 获取上次的错误码(如有)。更多...
|
|
bool | BadSocket () const |
| 检查是否发生了错误。更多...
|
|
Result | NonBlocking (bool non_block) |
|
bool | NonBlocking () const |
|
Result | RecvTimeout (std::chrono::seconds timeout) |
|
Result | SetBufSize (std::int32_t n_bytes) |
|
Result | SendBufSize (std::int32_t *n_bytes) |
|
Result | RecvBufSize (std::int32_t *n_bytes) |
|
Result | SetKeepAlive () |
|
Result | SetNoDelay (std::int32_t no_delay=1) |
|
TCPSocket | Accept () |
| 接受新连接,返回用于此新连接的 TCP socket。更多...
|
|
Result | Accept (TCPSocket *out, SockAddress *addr) |
|
| ~TCPSocket () |
|
| TCPSocket (TCPSocket const &that)=delete |
|
| TCPSocket (TCPSocket &&that) noexcept(true) |
|
TCPSocket & | operator= (TCPSocket const &that)=delete |
|
TCPSocket & | operator= (TCPSocket &&that) noexcept(true) |
|
HandleT const & | Handle () const |
| 返回原生 socket 文件描述符。更多...
|
|
Result | Listen (std::int32_t backlog=256) |
| 监听传入请求。应在 bind 后调用。更多...
|
|
Result | BindHost (std::int32_t *p_out) |
| 将 socket 绑定到 INADDR_ANY,返回 OS 选择的端口。更多...
|
|
auto | Port () const |
|
Result | Bind (StringView ip, std::int32_t *port) |
| 将 socket 绑定到指定地址。更多...
|
|
Result | SendAll (void const *buf, std::size_t len, std::size_t *n_sent) |
| 发送数据,如果无错误则应发送所有数据。更多...
|
|
Result | RecvAll (void *buf, std::size_t len, std::size_t *n_recv) |
| 接收数据,如果无错误则应接收所有数据。更多...
|
|
auto | Send (const void *buf_, std::size_t len, std::int32_t flags=0) |
| 使用 socket 发送数据。更多...
|
|
auto | Recv (void *buf, std::size_t len, std::int32_t flags=0) |
| 使用 socket 接收数据。更多...
|
|
std::size_t | Send (StringView str) |
| 发送字符串,格式与 RABIT 中的 Python socket 包装器匹配。更多...
|
|
Result | Recv (std::string *p_str) |
| 接收字符串,格式与 RABIT 中的 Python socket 包装器匹配。更多...
|
|
Result | Close () |
| 关闭 socket,如果 socket 未关闭,则在析构函数中自动调用。更多...
|
|
Result | Shutdown () |
| 对 socket 执行 shutdown 操作。更多...
|
|