23 #include <sys/socket.h> 24 #include <sys/types.h> 55 virtual bool open(
int socket_fd,
struct sockaddr* address,
size_t address_len)
59 virtual void setOptions(
int socket_fd);
61 bool setup(std::string& host,
int port);
97 std::string getIP()
const;
106 bool read(
char* character);
117 bool read(uint8_t* buf,
const size_t buf_len,
size_t& read);
128 bool write(
const uint8_t* buf,
const size_t buf_len,
size_t& written);
140 void setReceiveTimeout(
const timeval& timeout);
std::atomic< SocketState > state_
Connection to socket got closed.
std::atomic< int > socket_fd_
SocketState
State the socket can be in.
std::unique_ptr< timeval > recv_timeout_
Socket is initialized or setup failed.
Socket is disconnected and cannot be used.
SocketState getState()
Getter for the state of the socket.
Class for TCP socket abstraction.
Socket is connected and ready to use.
virtual bool open(int socket_fd, struct sockaddr *address, size_t address_len)
int getSocketFD()
Getter for the file descriptor of the socket.