Programs Talking to Each Other

Feb 3, 2012 at 7:17pm
I want to write a two different programs that talk to each other. They are on the same computer? How do I go about doing that? My understand the OS doesn't like programs doing that, ie seg faults.

-Thanks!
Feb 3, 2012 at 7:28pm
This is called "interprocess communication".

The wiki page is a good place to start: http://en.wikipedia.org/wiki/Inter-process_communication
Feb 3, 2012 at 8:25pm
The wiki doesn't do a good job explain the "how" part. Let me be a little more specific. I'd like two programs on the same computer to talk to each other, without using the hard drive. I know you can talk through the host ip address, but what IPC methods would I need to use?

Feb 3, 2012 at 9:20pm
You could use a signal, a socket, a pipe, a named pipe, shared memory or a memory-mapped file. The ease of each is a function of your operating system.
Feb 3, 2012 at 9:27pm
Which one of those methods is talking through the local host ip?
Feb 3, 2012 at 9:40pm
socket.
Feb 3, 2012 at 9:48pm
I work on some software that does this. It had a .lib, and .h file to share variable names, .dll to load some memory and get information, and a .pdp file. I don't know what the .pdp does but it may be worth looking into.

There is machine program on the same system (different computer, but in the same cabinet) which is designed to run just two applications. For this particular machine, the memory spots are hard coded. The base of the shared memory is set directly and both applications know the size since that part is done in C and doesn't change. The memory is on some specific PCI cards so we don't need to worry about the system overwriting that memory.
Last edited on Feb 3, 2012 at 9:50pm
Feb 3, 2012 at 9:49pm
If you decide on sockets, I recommend the beej guide:

http://beej.us/guide/bgnet/
Feb 3, 2012 at 10:01pm
Thanks!
Topic archived. No new replies allowed.