#pragma once #include #include #include class CTCPSocket; class CTCPServer : public CObject { C_OBJECT(CTCPServer) public: virtual ~CTCPServer() override; bool is_listening() const { return m_listening; } bool listen(const IPv4Address& address, u16 port); RefPtr accept(); IPv4Address local_address(); u16 local_port(); Function on_ready_to_accept; private: explicit CTCPServer(CObject* parent = nullptr); int m_fd { -1 }; bool m_listening { false }; RefPtr m_notifier; };