#ifndef REMOTE_SERVER_H #define REMOTE_SERVER_H #include #include #include #include #include #include #include #include #include #include #include #include using highClock_t = std::chrono::time_point; struct TranClient { std::shared_ptr wxSock; MutBuffer buffer; int64_t onlineTime; highClock_t lastRecvTime; }; class RemoteServer : public wxEvtHandler { public: RemoteServer(); public: bool Init(const wxString& ip, unsigned short port); int Run(); private: void OnServerEvent(wxSocketEvent& event); void thClientThread(const std::shared_ptr& wxSock, const wxString& id); private: wxWindowID serverId_; std::shared_mutex clientsMutex_; std::unique_ptr server_; std::unordered_map threads_; std::unordered_map> clients_; }; #endif // REMOTE_SERVER_H