Programming - .NET IPC (System.Remoting.IPC)
After some time, we have realised that .NET
seriously lacks a decent IPC structure, so we have gone about
implementing our own, which is available as an assembly which
you can link into your project. In pure managed .NET, it allows
processes to transfer objects across the IPC channel. Also,
with the current implementation, it should theoretically be
possible to talk heterogenous platforms such as C++ unmanaged,
Delphi and Java but
corresponding implementation will haveandto be done at a
later stage.
Please bear in mind, that our IPC infrastructure really is
just the transport. All the logic, and what your code can do is
totally up to you.and
You can download the installer here.
BriefandAPI is provided below:and
System.Remoting.IPC.Client:
Client code to connect to an IPC Channel.
//code snippet
Client<SharedObjects.MyObject> client = new
Client<SharedObjects.MyObject>();
client.BinaryMessageReceived += new
BinaryMessageReceivedHandler(client_BinaryMessageReceived);
client.SetChannel("OurApplicationSpace");
client.Connect();
void client_BinaryMessageReceived(object res)
{
SharedObjects.MyObject data = res as
SharedObjects.MyObject;
System.Console.WriteLine(data.GetConcatedString());
client.SendMessage("Thank you very much");
}
System.Remoting.IPC.Server:
Server code to start a controlling process which clients can
talk to:
//code snippet
Server<SharedObjects.MyObject> server = new
Server<SharedObjects.MyObject>();
server.BinaryMessageReceived += new
BinaryMessageReceivedHandler(server_BinaryMessageReceived);
server.MessageReceived += new
StringMessageReceivedHandler(server_MessageReceived);
server.SetChannel("OurApplicationSpace");
server.Start();
server.ObjectSender.Send(new SharedObjects.MyObject() {
Description = "a doggy", Item = "animal" });
//the above will serialise the object and send it over the
wire to the ther process which will deserialise the object into
its original form
void server_MessageReceived(string res)
{
System.Console.WriteLine(res);
}
void server_BinaryMessageReceived(object res)
{
SharedObjects.MyObject data= res as
SharedObjects.MyObject;
System.Console.WriteLine(data.GetConcatedString());
}
and