Interprocess C# Python Real Time
Solution 1:
Redis pub/sub is awesome... or ZeroMQ.
Solution 2:
Simplest way is PIPE
communication. another simple way that not suggested is SOCKET
programming. Pipes and Named pipes are good solution to communicate between different processes (over different programming languages). SOCKET
programming is like this but may need more Access Level and may be less security.
other type of IPCs seems be unusable.
see for more info:
Solution 3:
You may use our aktos-dcs and aktos-dcs-cs libraries. I have successfully used these libraries in production in order to make an RFID Reader (from Impinj) communicate with (actually, integrated in) our telemetry system. The RFID reader has a C# API and we are heavily using Python in our telemetry system.
The simplest test case is a pinger-ponger application, and here is how it looks like with these libraries:
pinger.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using aktos_dcs_cs;
namespacepinger
{
classPinger : Actor
{
publicvoidhandle_PingMessage(Dictionary<string, object> msg)
{
Console.WriteLine("Pinger handled PingMessage: {0} ", msg["text"]);
string msg_ser = @"
{""PongMessage"":
{""text"": ""this is proper message from csharp implementation""}
}
";
System.Threading.Thread.Sleep(2000);
send(msg_ser);
}
}
classProgram
{
staticvoidMain(string[] args)
{
Pinger x = new Pinger();
Actor.wait_all();
}
}
}
ponger.py:
from aktos_dcs import *
classPinger(Actor):
defhandle_PingMessage(self, msg_raw):
msg = get_msg_body(msg_raw)
print"Pinger got ping message: ", msg['text'], (time.time() - msg_raw['timestamp'])
sleep(2)
self.send({'PongMessage': {'text': "Hello ponger, this is pinger 1!"}})
if __name__ == "__main__":
ProxyActor()
pinger = Pinger()
pinger.send({'PongMessage': {'text': "Hello ponger, this is STARTUP MESSAGE!"}})
wait_all()
Post a Comment for "Interprocess C# Python Real Time"