From a43c00c56944ca69dcf319cd85754dc0fb1f2260 Mon Sep 17 00:00:00 2001 From: sirius-m Date: Thu, 4 Feb 2010 15:31:46 +0000 Subject: Added some basic IPC functionality using wxServer, wxClient and wxConnection. Added the -blockamount command line option for an example of usage. --- ipc.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 ipc.cpp (limited to 'ipc.cpp') diff --git a/ipc.cpp b/ipc.cpp new file mode 100644 index 000000000..86e57674e --- /dev/null +++ b/ipc.cpp @@ -0,0 +1,33 @@ +/* + * Inter-process calling functionality + */ + +#include "headers.h" + +wxConnectionBase * CServer::OnAcceptConnection (const wxString &topic) { + return new CServerConnection; +} + +wxConnectionBase * CClient::OnMakeConnection () { + return new CClientConnection; +} + +// For request based handling +const void * CServerConnection::OnRequest (const wxString &topic, const wxString &item, size_t *size, wxIPCFormat format) { + const char * output; + + if (item == "blockamount") { + stringstream stream; + stream << nBestHeight + 1; + output = stream.str().c_str(); + } + else + output = "Unknown identifier"; + + return output; +} + +// For event based handling +bool CClientConnection::OnAdvise (const wxString &topic, const wxString &item, const void *data, size_t size, wxIPCFormat format) { + return false; +} \ No newline at end of file -- cgit v1.2.3