23 static const unsigned int DefaultTCPTimeout = 500;
27 uint16_t _messageID = 0;
28 int _timeout = Connection::DefaultTCPTimeout;
31 explicit Connection() noexcept : _sockfd(-1), _messageID(0) {};
39 if (_sockfd != -1 && _sockfd != other._sockfd)
42 _sockfd = other._sockfd;
43 _messageID = other._messageID;
49 [[nodiscard]]
int getSockfd()
const {
return _sockfd; }
51 static Connection with(std::string addr,
int port);
62 [[nodiscard]] std::vector<uint8_t> awaitRawMessage();
64 [[nodiscard]] uint16_t getMessageId()
const {
return _messageID; }
66 void setMessageId(uint16_t messageId) { _messageID = messageId; }