| dandelion 2004-12-20, 5:50 pm |
|
"Charles Packer" <mailbox@cpacker.org> wrote in message
news:f88bc493.0412200749.79f9a046@posting.google.com...
First off, this is *off* topic on this ng. Having said that (to appease ye
daemons of c.l.c.)
> I need to do the following simple interprocess communication (IPC) among
these
> processes that are all on the same box:
^^^^^^^^^^^
> -- A daemon waits for "I'm here" announcements from multiple clients
> -- One or more clients send an "I'm here" to the daemon upon command
> via the client's GUI (Each client's GUI is viewed by a different
> human user)
> The daemon retransmits "X is here" to all clients when it receives any
"I'm here".
Ok.
> I read some tutorials on message queues and sockets and have tried their
examples,
> but that's the extent of my experience in this area. Since I'm going to
have
> to invest a significant amount of time learning molecular-level trivia
about
> IPC to implement the application in C, I'd like some opinions as to which
IPC
> scenario -- sockets, message queues, etc. is most appropriate for my
application
> model.
Since all your processes are on the same box, i'd suggest a named pipe. They
are the
simplest method of IPC I know of yet are very usable. If you supply the
server and all
the clients with some unique id, you only need 2 pipes (they are
half-duplex), since writes
to pipes are guaranteed to be atomic (POSIX). Furthermore, they are
supported over a
range of OS's.
See
http://developers.sun.com/solaris/a...amed_pipes.html
http://librenix.com/?inode=4423
|