Interprocess Communication In .NET

If you have completed an application and wish to share the complete source/project files with everyone then please post it in here. Source-code files only, no tutorials.
1 post Page 1 of 1
Contributors
User avatar
visualtech
VIP - Donator
VIP - Donator
Posts: 265
Joined: Sat Nov 19, 2011 2:19 pm

Well you might be wondering what is Inter-Process Communication. In simple words, Inter-Process Communication means Processes That Can Talk to Each Other.

In this article we'll call Inter-Process Communication as IPC.

You Might Be Wondering:


Why the heck would I use IPC?

Ans. There Can Be a Variety of Reasons For That, Such As:
  • Make one process do the hard-work while showing simple output to users
Say, that you made a License Manager:

The User Enters The Key
You Made Another Application (Process) Which Has IPC Enabled. Let us call it: licman.exe
The Registration Form Communicated To licman.exe
The Registration Form Shows The Progress Bar and a Label Saying "Validatng..."
While The licman.exe is Verifying Your Key in the Background.
Once Your licman.exe Validated it, Say It's Valid
The licman.exe Sends the Valid Response
The Registration Form, Tells It To The User And The Application Continues.

So, that can be a typical example of IPC.

Now you might be wondering, "Hmm, sounds interesting, but how do I do it?"

Well, there are Good Methods and there are Bad Methods.

Bad Methods:
  • Shared Memory
- Extremely difficult to manage and use
  • Shared Files/Memory
- Very slow as it Reads/Writes from/to the disk. Difficult to mamage
  • SendMessage/PostMessage
- Locks up the UI thread while the message is being processed. Requires elevation.


Good Method:
  • Named Pipes
- Lets put it this way:


You might have played the classical game, Mario. In that game you might have come across pipes. When you jump on the pipe, you go through it.
Your going through, in IPC, will be the text, binary data, etc. going.

Which app uses this IPC?

Well, you might be using that app right now to browse the Internet, Google Chrome

Yeah, its right, it uses IPC, for communication between tabs, plug-ins etc.

Well, that sounds great, but what do I put in the pipe?

Ans. That depends on for what you are using the IPC for.

The 'Hand Rule' says that 'Keep You Message Short and Simple'


Download the .NET Source

In the zip file, there is a simple program to demonstrate the use of IPC.


This file is hosted off-site.

So, that's it for this tutorial.

+REP If You Liked It

Throw in your comments to let me know if something is lacking in this article!

-Chris
Image
1 post Page 1 of 1
Return to “Source-Code”