cross platform IPC

I'm looking for suggestions on possible IPC mechanisms that are:

  • cross platform (WIN32 and Linux at least)
  • Simple to implement in C++ as well as the most common scripting languages (perl, ruby python etc).
  • Finally, simple to use from a programming point of view!

What are my options? I'm programming under Linux, but I'd like what I write to be portable to other OSes in the future. I've thought about using sockets, named pipes, or something like DBus.

Does anyone have any advice?


In terms of speed, the best cross-platform IPC mechanism will be pipes. That assumes, however, that you want cross-platform IPC on the same machine. If you want to be able to talk to processes on remote machines, you'll want to look at using sockets instead. Luckily, if you're talking about TCP at least, sockets and pipes behave pretty much the same behavior. While the APIs for setting them up and connecting them are different, they both just act like streams of data.

The difficult part, however, is not the communication channel, but the messages you pass over it. You really want to look at something that will perform verification and parsing for you. I recommend looking at Google's Protocol Buffers. You basically create a spec file that describes the object you want to pass between processes, and there is a compiler that generates code in a number of different languages for reading and writing objects that match the spec. It's much easier (and less bug prone) than trying to come up with a messaging protocol and parser yourself.

Need Your Help

My Android app is freezing when I call bufferedReader.readLine();

java android bufferedreader android-wear channel-api

I created a new Android Studio project for an Android phone and an Android Wear to test the ChannelApi. It seems that everything works fine in my project, except that inside the onChannelOpened met...