BellSocket.h 429 B

12345678910111213141516171819
  1. #pragma once
  2. #include <string>
  3. namespace bell {
  4. class Socket {
  5. public:
  6. Socket(){};
  7. virtual ~Socket() = default;
  8. virtual void open(const std::string& host, uint16_t port) = 0;
  9. virtual size_t poll() = 0;
  10. virtual size_t write(uint8_t* buf, size_t len) = 0;
  11. virtual size_t read(uint8_t* buf, size_t len) = 0;
  12. virtual bool isOpen() = 0;
  13. virtual void close() = 0;
  14. virtual int getFd() = 0;
  15. };
  16. } // namespace bell