Re: Inter Process Communications
From: Joseph M. Newcomer (newcomer_at_flounder.com)
Date: 01/14/05
- Next message: Joseph M. Newcomer: "Re: How to kill a worker thread"
- Previous message: reno: "Re: How to install a COM PORT hook"
- In reply to: W Akthar: "Inter Process Communications"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 14 Jan 2005 12:38:54 -0500
If the "server process" is a system service, you have some problems, because most of the
IPC mechanisms do not work well across desktops. In this case, you probably want to use a
named pipe. But for a simple IPC between two processes running in the same desktop, window
messages, thread messages, and with a bit of work, an I/O Completion Port.
When I use window messages, I usually do something like broadcast a Registered Window
Message which contains in its WPARAM (for example; it could have been LPARAM) the window
handle of my window. The receiving process, when it gets the message, does a PostMessage
to the window whose handle came in, containing its own window handle. Now communication is
established.
Ususally when I do this, I make sure that the processes can start up in any order. So when
a process starts up, it broadcasts "I'm the client" or "I'm the server" as window
messages, so they can be restarted in any order. If I get an "I'm the server message" as a
client, it means the server has shut down and been restarted, so as a client I reset my
target. Likewise, when, as a server, I get a new "I'm a client" it overrides the client
response previously accepted.
Note that you probably need to make sure that you can't have multiple instances of the
programs running. See my MVP Tips essay on this.
joe
On Fri, 14 Jan 2005 08:34:29 -0800, "W Akthar" <anonymous@discussions.microsoft.com>
wrote:
>Hi,
>
>I need to develop a system which consists of a UI
>application and an another server process which sends and
>receives messages from a modem. I do not need to
>implement the serial communications as someone else will.
>Also most of the UI will be implemented by someone else.
>
>The thing I need to implement is the communication
>between the two processes. That is sending and receiving
>messages from the server process.
>What are the ways I can achieve this, using sockets?
>Are there any examples of implementing something similar
>to my problem anywhere on the web or can someone explain
>how I could do this?
>
>Thanks in advance !!!
>
>Cheers
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
- Next message: Joseph M. Newcomer: "Re: How to kill a worker thread"
- Previous message: reno: "Re: How to install a COM PORT hook"
- In reply to: W Akthar: "Inter Process Communications"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|