#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(); Optional local_address() const; Optional local_port() const; Function on_ready_to_accept; private: explicit CTCPServer(CObject* parent = nullptr); int m_fd { -1 }; bool m_listening { false }; RefPtr m_notifier; };