#pragma once #include "result.hpp" #include #include #include #include namespace mst { class TcpListener; class TcpConnection { public: auto write(uint8_t* buffer, size_t len) -> Result; auto read(uint8_t* buffer, size_t len) -> Result; TcpConnection(TcpListener&, int fd) : fd(fd) { }; int fd; }; class TcpListener { public: static auto bind(const std::string& host, uint16_t port) -> Result; auto accept() -> Result; int fd; private: TcpListener(sockaddr_in address, int fd) : fd(fd) , address(address) { }; sockaddr_in address; }; }