theRainbird / CoreRemoting

RPC library with classic .NET Remoting flavour
MIT License
63 stars 23 forks source link

Replacement for classic remoting IpcChannel ? #36

Open curunoir opened 1 year ago

curunoir commented 1 year ago

Hello, first thanks for this project which can be very helpful.

I have to upgrade an old .net framework projecttowards .net core 6 which used .net remoting with Ipc channels, like this on client side

 ipcCh = new IpcChannel("someChannelName");
ChannelServices.RegisterChannel(ipcCh, true);

 obj = (ISharedAssemblyInterface)Activator.GetObject
     (typeof(.ISharedAssemblyInterface),
     ipc://LocalServer/RemoteCommunication");

As I looked into examples and documentation I don't think CoreRemoting is supporting interprocess without the use of a network layer such as tcp or http. It might be an issue for this application to listen on a dedicated port as it is widely distributed on various workstations where I don't have control and this dedicated port would already by taken.

But maybe there is something in CoreRemoting which might fit my use case and I didn't find it yet so I'm humbly asking here if you have some ideas or maybe some alternatives which will help me replace an alternative for classic remoting with Ipc channels.

Cheers.

theRainbird commented 1 year ago

Hello curunoir,

a IpcChannel for CoreRemoting is already on my todo list. However, it may take some time before I find time to implement this.

If you don't have the time to wait. You can also implement your own IpcChannel. Just implement IServerChannel and IClientChannel interfaces. The original .NET Remoting IpcChannel uses Named Pipe protocol, which is also available in .NET Core / .NET 5+: https://learn.microsoft.com/en-us/dotnet/api/system.io.pipes.namedpipeserverstream?view=net-7.0 https://learn.microsoft.com/en-us/dotnet/api/system.io.pipes.namedpipeclientstream?view=net-7.0

The following code project article can be used as inspiration how to send and receive byte-arrays via named pipe protocol: https://www.codeproject.com/Articles/864679/Creating-a-Server-Using-Named-Pipes.

Channels in CoreRemoting must only handle the raw message transport (sending and receiving byte-arrays).

Best regards, Rainbird

curunoir commented 1 year ago

Hello theRainbird,

thanks for your answers. It's good to know that this feature was on your todolist already.

I had already found that Named pipes was one of the replacement candidate in Microsoft upgrade documentation so I will dig that way. In case I can implement this as a CoreRemoting channel easily maybe I will let you know what I have found though it is possible that using the most simplest implementation woud be the best for this application which is deployed at great scale.

Best regards, curunoir