mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:58:11 +00:00

Instead of trying to support both client and server in CLocalSocket, let's have a specialized server class. The basic usage is: CLocalServer server; server.listen("/tmp/name-of-portal"); server.on_ready_to_accept = [&] { CLocalSocket* client = server.accept(); ... }; This will make things a lot simpler, since an accepting socket doesn't need half of the stuff that a regular CIODevice provides. :^)
16 lines
391 B
C++
16 lines
391 B
C++
#pragma once
|
|
|
|
#include <AK/Badge.h>
|
|
#include <LibCore/CSocket.h>
|
|
|
|
class CLocalServer;
|
|
|
|
class CLocalSocket final : public CSocket {
|
|
C_OBJECT(CLocalSocket)
|
|
public:
|
|
explicit CLocalSocket(CObject* parent = nullptr);
|
|
CLocalSocket(Badge<CLocalServer>, int fd, CObject* parent = nullptr);
|
|
virtual ~CLocalSocket() override;
|
|
|
|
virtual bool bind(const CSocketAddress&) override;
|
|
};
|