Out of Process IPC/TCP Remoting code

Click this link for a description of the source code


I have attached the VS solutions in the file: SourceSolution.zip

View Source: Show Code ...

HostApp project – RemotingSamples Program.cs



Comments (10)
  1. I previously wrote about bi-directional remoting over IPC (see .Net Remoting continued and .Net Remoting

  2. j.monty says:

    Excellent info. I’ve been having trouble getting the IPC channel to work (but tcp channel seems to work just fine)….I’ll be checking out your sample code for differences with some code I’m working on. Thanks for posting it.

    Seems like most of the remoting examples create a console app that puts a Console.ReadLine() at the end of the Main() method to demo remoting host which leads to my next question.

    Is there a bullet-proof way to host the remoting host in a service – think Tray GUI Application that communicates status, logging information, etc. with a Windows Service using remoting? I want the connection to the remoting host in the Service to be solid – I’ve been trying to get one to function ‘properly’ in a service, but the delegates I have wired up seem to stop firing. However the rest of the object references seems to function properly – however, I’m not yet convinced it’s a problem with remoting, but I’m still interested in some feedback.




  3. The ReadLine() is just thier to pause execution.  Otherwise the app/process would run to completion and shutdown.

    I’m not sure I understand your service question. Delegates and events should be fine over remoting.

  4. besto says:


    It is possible to host the remoting server in a Windows Service – I’ve done it in two projects now during this spring/early summer.

    It though requires the service to be running (IMO not a rough requirement) to host the remoting server, and the trick is to register the server and put op the server work in the OnStart event of the service. In the OnStop, the remoting server is torn down.

    In the one project, I’m using this method to host a settings server as I have some settings that are used in two different projects. The one project (that also updates the settings) is pure managed code (C#). The other project is a managed code (C#) project that is an add in to a non-managed code project and is loaded into a process that I do not control.

  5. paresh masani says:

    Hi Jack,

    I want to send a signal(some type of info) only once from process A to process B. untill signal arrived process B has to wait. Could you please tell me the simple way to do this in C# using IPC. it will really very helpful to me.



  6. Hi Paresh, I am making some assumptions because you didn’t tell me whether A or B was the Client or Server.  There are also other ways of implementing callbacks and/or event models.

    Referring to the sample code I posted, the Host app (i.e., “A”) has an object it expects clients (i.e., “B”) to implement. In this case, “RemoteObject”.  

    When “A” calls the method, it “signals” (i.e., calls a method implemented by “B”) “B” which in turn will do some action based on “A” calling the Remote object.  “B”’s implementation of RemoteMethod() waits until called/signaled before running any code.

  7. function ToggleDisplay (label, control) { if (control.style.display == "none") { control.style.display

  8. Greg says:

    Great remoting example…

    Just to clarify something; HostApp is the ‘server’ and RemoteApp is the client or is it the other way around?

    Silly question isnt it?


  9. Greg, In this example, the Host plays a dual role (i.e, Server and Client). Basically, Clients make calls to Servers. You can see that the Host registers both a client and server provider. – Jack

Comments are closed.

Skip to main content