interprocess

can a python script know that another instance of the same script is running… and then talk to it?

ぐ巨炮叔叔 提交于 2019-12-02 19:35:14
I'd like to prevent multiple instances of the same long-running python command-line script from running at the same time, and I'd like the new instance to be able to send data to the original instance before the new instance commits suicide. How can I do this in a cross-platform way? Specifically, I'd like to enable the following behavior: " foo.py " is launched from the command line, and it will stay running for a long time-- days or weeks until the machine is rebooted or the parent process kills it. every few minutes the same script is launched again, but with different command-line

How to start an Android activity from a Unity Application?

放肆的年华 提交于 2019-12-02 17:46:39
I know this seems to be a trivial question but I could not find any concrete answer anywhere on the internet. I saw this very similar question on stackoverflow: How to start Unity application from android activity? but it is exactly opposite from my question. Additionally the android activity must be able to receive some input strings from the Unity application much like how one use system() calls with line arguments to start another program on a PC. The following is the code I have for a test button event handler for my test Unity app on Android: private void ExternalAppCallHandler() { if

any good and simple RPC library for inter-process calls? [closed]

戏子无情 提交于 2019-12-02 14:09:42
I need to send a (probably one) simple one-way command from client processes to server process with arguments of builtin C++ types (so serialization is pretty simple). C++, Windows XP+. I'm looking for a library that doesn't require complicated configuration, provides simple interface, doesn't require hours to days of learning and doesn't have commercial usage restrictions. Simple solution for simple problem. Boost.Interprocess is too low-level for this simple task because doesn't provide RPC interface. Sockets are probably an overkill too because I don't need to communicate between machines.

Win32: How to post message to a process run by a different user in Windows?

我与影子孤独终老i 提交于 2019-12-02 12:22:46
问题 We run two application, each of them register the same message using RegisterWindowMessage(): application A as a regular user and application B as administrator in the same user's session on the machine, and those applications would send this message one to another. When A and B were run as a same user everything was fine and we were able to communicate using PostMessage() messaging. Now as application B is run as administrator messages do not come through any more. What can we do about it?

boost interprocess file_lock does not work with multiple processes

荒凉一梦 提交于 2019-12-01 22:17:26
I seem to be having an issue with boost::interprocess::file_lock I have process 1 that is essentially boost::interprocess::file_lock test_lock("testfile.csv"); test_lock.lock(); sleep(1000); test_lock.unlock(); When I run a second process while the first process is sleeping, I find that I am still able to read testfile.csv. What's worse, I can even overwrite it. Am I misinterpreting how file_lock works? I was under the impression that calling .lock() gives it exclusive lock over the file and prevents any other process from read/modifying the file. Joe file_lock is not for locking a file. It is

Boost.Process - how to make a process run a function?

时光毁灭记忆、已成空白 提交于 2019-12-01 09:19:57
So I try to do something with Boost.Process though it has not been accepted into the Boost distribution yet. simpliest programm would look like #include <boost/process.hpp> #include <string> #include <vector> namespace bp = ::boost::process; void Hello() { //... contents does not matter for me now - I just want to make a new process running this function using Boost.Process. } bp::child start_child() { std::string exec = "bjam"; std::vector<std::string> args; args.push_back("--version"); bp::context ctx; ctx.stdout_behavior = bp::silence_stream(); return bp::launch(exec, args, ctx); } int main

Boost.Process - how to make a process run a function?

落花浮王杯 提交于 2019-12-01 06:13:44
问题 So I try to do something with Boost.Process though it has not been accepted into the Boost distribution yet. simpliest programm would look like #include <boost/process.hpp> #include <string> #include <vector> namespace bp = ::boost::process; void Hello() { //... contents does not matter for me now - I just want to make a new process running this function using Boost.Process. } bp::child start_child() { std::string exec = "bjam"; std::vector<std::string> args; args.push_back("--version"); bp:

How to solve “The ChannelDispatcher is unable to open its IChannelListener” error?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 03:24:38
I'm trying to communicate between WCF hosted in Windows Service and my service GUI. The problem is when I'm trying to execute OperationContract method I'm getting "The ChannelDispatcher at 'net.tcp://localhost:7771/MyService' with contract(s) '"IContract"' is unable to open its IChannelListener." My app.conf looks like that: <configuration> <system.serviceModel> <bindings> <netTcpBinding> <binding name="netTcpBinding"> <security> <transport protectionLevel="EncryptAndSign" /> </security> </binding> </netTcpBinding> </bindings> <behaviors> <serviceBehaviors> <behavior name="MyServiceBehavior">

Boost named_mutex and remove() command

[亡魂溺海] 提交于 2019-11-30 19:32:32
I have a class which can be created by multiple threads. But at one function the code needs to be protected, so I decided to use the boost interprocess mutex. Every class creates or opens the same Mutex in it's constructor: MyClass::MyClass() { boost::interprocess::named_mutex m_Lock( boost::interprocess::open_or_create, "myLock" ); } So now there comes the point where the critical code part is called: int MyClass::MyFunction() { boost::interprocess::scoped_lock<boost::interprocess::named_mutex> lock( m_Lock, boost::interprocess::try_to_lock); if(!lock) { return -1; } // else do some stuff

C++ application: Is it possible to pass accepted TCP connection from one process to another?

北慕城南 提交于 2019-11-30 09:02:02
问题 So I wonder - is it possible to pass accepted TCP connection (on Windows or Unix like OS) from one process to another? Here the point is to pass connection - not data in a way a proxy app would. 回答1: On Windows, use WSADuplicateSocket, pass the filled in WSAPROTOCOL_INFO to the other process, use WSPSocket to recreate a socket. On unix-like OS'es this is possible using the sendmsg() system call. libancillary abstracts this for you. 回答2: In Unix, a TCP connection is represented as a socket