libnick 2025.1.0
A cross-platform base for native Nickvision applications.
Loading...
Searching...
No Matches
interprocesscommunicator.h
Go to the documentation of this file.
1
23#ifndef INTERPROCESSCOMMUNICATOR_H
24#define INTERPROCESSCOMMUNICATOR_H
25
26#include <memory>
27#include <string>
28#include <thread>
29#include "events/event.h"
31#include "network/socket.h"
32
33namespace Nickvision::App
34{
39 {
40 public:
47 InterProcessCommunicator(const std::string& id);
62 bool isServer() const;
67 bool isClient() const;
75 bool communicate(const std::vector<std::string>& args, bool exitIfClient = false);
76
77 private:
81 void runServer();
82 std::string m_id;
83 bool m_serverRunning;
84 std::unique_ptr<Network::Socket> m_serverSocket;
85 std::thread m_server;
87 };
88}
89
90#endif //INTERPROCESSCOMMUNICATOR_H
An inter process communicator (server/client).
Definition interprocesscommunicator.h:39
bool communicate(const std::vector< std::string > &args, bool exitIfClient=false)
Communicates to the IPC server instance.
Events::Event< Events::ParamEventArgs< std::vector< std::string > > > & commandReceived()
Gets the event for when a command is received.
InterProcessCommunicator(const std::string &id)
Constructs an InterProcessCommunicator.
bool isServer() const
Gets whether or not this instance is an IPC server.
~InterProcessCommunicator()
Destructs an InterProcessCommunicator.
bool isClient() const
Gets whether or not this instance is an IPC client.
An event that can have handlers subscribe to it, which in turn will be called when the event is invok...
Definition event.h:49
Definition appinfo.h:32