CLocalServer.h 541 B

1234567891011121314151617181920212223242526
  1. #pragma once
  2. #include <LibCore/CNotifier.h>
  3. #include <LibCore/CObject.h>
  4. class CLocalSocket;
  5. class CLocalServer : public CObject {
  6. C_OBJECT(CLocalServer)
  7. public:
  8. virtual ~CLocalServer() override;
  9. bool is_listening() const { return m_listening; }
  10. bool listen(const String& address);
  11. ObjectPtr<CLocalSocket> accept();
  12. Function<void()> on_ready_to_accept;
  13. private:
  14. explicit CLocalServer(CObject* parent = nullptr);
  15. int m_fd { -1 };
  16. bool m_listening { false };
  17. ObjectPtr<CNotifier> m_notifier;
  18. };