#include #include #include #define AS_DEFAULT_BUFFER_SIZE 0x1000 /*4096 bytes*/ namespace TcpSocket { void setTimeout(int seconds, int sock); ssize_t sendt(int sock, const void *bytes, size_t byteslength); ssize_t recvt(int sock, void *bytes, size_t byteslength); void closet(int sock); std::string remoteAddress(sockaddr_in &address); int remotePort(sockaddr_in &address); int connectt(const char *host, uint16_t port); typedef std::function OnNewConnectionCallBack; int listent(const char *host, uint16_t port, OnNewConnectionCallBack callback); } // namespace TcpSocket