|
auto | Domain () const -> SockDomain |
| Return the socket domain.
|
|
bool | IsClosed () const |
|
std::int32_t | GetSockError () const |
| get last error code if any
|
|
bool | BadSocket () const |
| check if anything bad happens
|
|
void | SetNonBlock () |
|
void | SetKeepAlive () |
|
void | SetNoDelay () |
|
TCPSocket | Accept () |
| Accept new connection, returns a new TCP socket for the new connection.
|
|
| TCPSocket (TCPSocket const &that)=delete |
|
| TCPSocket (TCPSocket &&that) noexcept(true) |
|
TCPSocket & | operator= (TCPSocket const &that)=delete |
|
TCPSocket & | operator= (TCPSocket &&that) |
|
HandleT const & | Handle () const |
| Return the native socket file descriptor.
|
|
void | Listen (std::int32_t backlog=16) |
| Listen to incoming requests.
|
|
in_port_t | BindHost () |
| Bind socket to INADDR_ANY, return the port selected by the OS.
|
|
auto | SendAll (void const *buf, std::size_t len) |
| Send data, without error then all data should be sent.
|
|
auto | RecvAll (void *buf, std::size_t len) |
| Receive data, without error then all data should be received.
|
|
auto | Send (const void *buf_, std::size_t len, std::int32_t flags=0) |
| Send data using the socket.
|
|
auto | Recv (void *buf, std::size_t len, std::int32_t flags=0) |
| receive data using the socket
|
|
std::size_t | Send (StringView str) |
| Send string, format is matched with the Python socket wrapper in RABIT.
|
|
std::size_t | Recv (std::string *p_str) |
| Receive string, format is matched with the Python socket wrapper in RABIT.
|
|
void | Close () |
| Close the socket, called automatically in destructor if the socket is not closed.
|
|
TCP socket for simple communication.