#pragma once #include #include #include #include #include #include #include #include "ur_modern_driver/tcp_socket.h" class URServer : private TCPSocket { private: int port_; TCPSocket client_; protected: virtual bool open(int socket_fd, struct sockaddr *address, size_t address_len) { return ::bind(socket_fd, address, address_len) == 0; } virtual void setOptions(int socket_fd); public: URServer(int port); std::string getIP(); bool bind(); bool accept(); void disconnectClient(); bool write(const uint8_t* buf, size_t buf_len, size_t &written); };