Click to See Complete Forum and Search --> : How two programs communicate with each other in the same machine in VC++?


wky086
July 12th, 2001, 09:56 PM
How two programs communicate with each other in the same machine?
Hi:
Here I have a question which maybe very simple to programmers.
There has programs have to tell each other their's status. Where both
programs have been developed already and run on the same machine. the status will change
every second .How many ways can I implement it?
1. Register the parameters in the registry , read and update the registry file when there
have status change on parameter.
2. Use socket to send the parameter to other program about it's status.
3. or have other method that program can communicate with each other???
If anybody have ideas of how to implement and their advantages and disvantages can share with me. It will
be very helpful.
Millions of thanks in advance

wky086

Pham Son Thuy
July 13th, 2001, 12:03 AM
use
PostMessage(...) or
SendMessage(...)

Stefan Holmberg
July 14th, 2001, 05:04 PM
I would choose between:

* Pass the data through shared memory ( accessible from both apps ). The fastest way. Need some synchronisation ( polling is a absolute nono ! ), check out named semaphores.
* Sockets, as you mentioned. Pretty fast and it is not too hard to implement the easy communication scheme you are about to setup. Pro: Can scale out so you can move one of the processes to another machine if that would be needed?