Possible duplicate:
Is it possible to pass C #?
Is there a way to connect two programs over the network so that all calls coming from one program can be transferred to another computer and then transferred to the receiving program. I have included one of the ways that I could do this below, but there should be a better way, since it will be heavy (and seemingly senseless) code to keep abreast of the latest developments. The program I'm working with is Ascom, which uses a lot of interprocess communication with COM. This is just an example; there are many interfaces that will need to be updated.
class SwitchConverter : ASCOM.Interface.ISwitch { private Client client = new Client(); private string query(string query){ return client.query(query); } private void send(string command) { client.send(command); } public bool Connected { get { return bool.Parse(query("SWITCHGETCONN")); } set { send("SWITCHSETCONN:" + value); } } public string Description { get { return query("SWITCHGETDESC"); } } public string DriverInfo { get { return query("SWITCHGETDRVI"); } } public string DriverVersion { get { return query("SWITCHGETDRVV"); } } public bool GetSwitch(short ID) { return bool.Parse(query("SWITCHGETSTAT:" + ID)); } public string GetSwitchName(short ID) { return query("SWITCHGETNAME:" + ID); } public short InterfaceVersion { get { return short.Parse(query("SWITCHGETINTV")); } } public short MaxSwitch { get { return short.Parse(query("SWITCHGETMAXS")); } } public string Name { get { return query("SWITCHGETNAME"); } } public void SetSwitch(short ID, bool State) { send("SWITCHSETSTAT:" + ID + "-" + State); } public void SetSwitchName(short ID, string Name) { send("SWITCHSETNAME:" + ID + "-" + Name); } public void SetupDialog() { throw new NotImplementedException(); } }
So, as you can see, it will look like this:
/== Encoder ==\ /== Decoder ==\ /=== Encoder ===\ /=== Decoder ===\ /==== Encoder ====\ /==== Decoder ====\ Client ==<===== Encoder =====>== Pipe ==<===== Decoder =====>== Server \==== Encoder ====/ \==== Decoder ====/ \=== Encoder ===/ \=== Decoder ===/ \== Encoder ==/ \== Decoder ==/
Now, is there a way to simply take the server interface and pass it to the client, and take the client interface and pass it to the server, as shown below? Thus, the server will call the receiver, and the pipe will forward it to the client. If the client calls the server, it simply redirects it to the server. Since we are dealing with individual programs, this should be very simple, I would think. I read about .NET Remoting, but this is clearly not recommended. I used to ask this question, but no one answered, so I thought I would tell // exactly // what I'm doing.
Client ====(<Server) Pipe (Client>)==== Server
When I say pipe, I mean a connection that sends data from one program to another over the network. In addition, I am looking for either an implementation example or a link to an implementation example. Don't just try x or y. It should be possible!
In short, I'm trying to make the client and server communicate as if they were on the same computer, where they use COM, without having a โman in the middleโ, something translates, just connect them.