Reputation: 4817
I recently forced to find an IPC protocol that is best for communicate between java and c++.
I searched the SO for finding best protocol for this, I found socket is the best approach for this, in SO. But I couldn't find any thing about its cons or pros of sockets! So I want to know pros of this protocol and also I want to know pros of other protocol vs socket to choose best protocol for my application.
It is very likely that my two applications running on a same machine.
Update I should first select my protocol then I can decide run it on which system configuration.
Upvotes: 1
Views: 2009
Reputation: 2671
The best IPC method really depends on what type of communication you have: Message passing, ensuring mutual exclusive execution, sharing data are various IPC, but sockets isn't the solution for all 3.
Think about, or provide information what form the information has you want to pass between the applications. Perhaps you find a typical scenario (like producer-consumer problem).
If you have a message-passing problem, comparable in principle to oldschool TCP services, sockets are a good idea because they are well-tested and easy to debug; They provide full decoupling, yet running locally doesn't have drawbacks compared to pipes because the kernel can do the blocking of one application (sender or receiver) efficiently.
Sockets can be UDP, TCP or Unix sockets. In any case you don't need a network card for local IPC with sockets.
Upvotes: 3