Eduardo

Eduardo

  • NA
  • 13
  • 16.5k

How to transfer text messages between two applications?

Apr 9 2010 10:19 AM
Hi all,

I am using C#.Net Visual Team Studio 2008.
I have two (or more), applications on the same PC and need to transfer simple text messages between the app's.
Since i just want to transfer text messages, i expect to use a clean and simple code to do it.
I don't want to use databases, files and other things like this, i want to use something inside the framework 3.5.

I figured out on how to do this using message queue from windows, that was very simple, but all my users need to install Windows Message Queue because it is not installed by default, even in Windows 7.

I tried to use Named Pipes, but damm, that is too complex. The samples that i found uses WaitForConnection() method, but this is not cool because my application freezes at this line waiting forever for a connection...
So, i figured out that i can use BeginWaitForConnection instead of WaitForConnection but i did not found any examples about it. Another thing about named pipes is that on app will be a server and another a client, this is not what i want, i need app1 and app2 talking each other, full duplex :)

So i ask you guys:
is the named pipe the best method to use for me?
if it was, does anybody has a sample code using BeginWaitForConnection to help me?

Example:

I have APP1, and APP2
APP1 launches APP2 and show to the user a screen:  waiting...(on APP1), and a Cancel button
So, user can cancel if he wants...
APP2 will appear and the user will interface with it, at some point APP2 need to tell to APP1 that the procedure was executed succefully or not and quit.
APP1 is waiting the response from APP2 and user cannot do anything until the messages come or the CANCEL button is pressed. So, APP1 can wait inside a while...doevents

thanks!!

Answers (3)