BellSocket.h 492 B

123456789101112131415161718192021
  1. #ifndef BELL_SOCKET_H
  2. #define BELL_SOCKET_H
  3. #include <string>
  4. namespace bell {
  5. class Socket {
  6. public:
  7. Socket() {};
  8. virtual ~Socket() = default;
  9. void open(const std::string &url);
  10. virtual void open(std::string host, uint16_t port) = 0;
  11. virtual size_t poll() = 0;
  12. virtual size_t write(uint8_t* buf, size_t len) = 0;
  13. virtual size_t read(uint8_t* buf, size_t len) = 0;
  14. virtual void close() = 0;
  15. };
  16. }
  17. #endif