Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How should I implement a distributed Remote Method Invocation system in .NET?

Tags:

c#

.net

tcp

udp

rmi

Original Post

How would I implement a distributed Remote Method Invocation system?

I'm trying to create something like the following:

  • Master Server to track individual "hosts".
  • Hosts can communicate with other hosts on the network using a proxy-object-interface based programming style, example: var result = remoteHost.MyMethod(5);

I've tried using RMI libraries like SuperPool and Scs, however they have a few fundamental issues:

  • SCS Supports only Server --> Client or Client --> Server communication, no Client --> Client communication.
  • As far as I can tell, SuperPool only supports the same, although this picture would suggest otherwise, I cannot find anything in the documentation on how to do this: enter image description here

The difference would be that any component on clients can also communicate with components on other clients, as opposed to only client-->server or server-->client communication.

How would you suggest I implement this (perhaps using these existing solutions as a base), or is there some other existing solution that might work?

More Extensive Example

Here is a diagram of what I'm trying to do: enter image description here

IMPORTANT NOTE: Clients do NOT connect to each other.

Process:

  1. Client1 connects to Server
  2. Client2 connects to Server
  3. Client1 invokes a method on Client2, without knowing if the component of Client2 exists on the Server, another Client, or itself.

The idea is the same as what SuperPool has done, except allowing the Client --> Server --> Client communication path for invoking a method on the second client.

like image 586
Christian Stewart Avatar asked Oct 22 '22 10:10

Christian Stewart


1 Answers

Although ZeroMQ is quite low level, it supports bidirectional communication and has .NET support and is available on nuget.org

You can multiplex many bidirectional conversations on a DEALER/ROUTER or DEALER/DEALER socket pair and either side can initiate a conversation.

Be aware though that ZeroMQ does not come with everything ready to do method invocation; you would have to create your own protocol or use an existing one and implement it.

Both Salt and Cloudless, built on top of ZeroMQ, provide remote method invocation.

ZeroMQ facilitates very robust asynchronous sockets (and more) Routing messages is absolutly possible. If you combine the Ventilator and Sink in the ZeroMQ Guide you are very close to what you want to accomplish.

Note that you would still have to implement the actual protocol and method invocation.

like image 184
Emond Avatar answered Oct 31 '22 20:10

Emond