#pragma once #include #include #include #include #include class TInetStreamSocket; // Simple server listens on the specified port and launches // requestHandler in the separate thread for each incoming connection. class TSimpleServer { public: using TRequestHandler = std::function; public: TSimpleServer(int port, TRequestHandler requestHandler); ~TSimpleServer(); void Stop(); int GetPort() const; TString GetAddress() const; private: const int Port_; THolder ThreadPool_; THolder ListenerThread_; THolder SendFinishSocket_; };