• Post Reply Bookmark Topic Watch Topic
  • New Topic

Inter-Process communication in Java  RSS feed

 
Arun Subbu
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to make two Java processes communicate with each other.I want to know which one will be the easiest one(Pipes,Named Pipes,Mailslots,shared memory etc). I can use all these methods in C++, but how to do them in Java.Is there any good tutorial available?All the ones I have seen so far are kind of advanced and I cannot follow them.The Process A and B has to communicate with very simple messages(To be precise, Process A will tell it is out there running and process B will query using IPC mechanism to see A is there running and if so,it does it own course of action). I dont want to use File based or Socket based communication.

Thanks in Advance.
Arun.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sockets, RMI, SOAP, just to name a few.
 
M Beck
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you don't mind me asking, why don't you want to use sockets in this application? they sound like the perfect match to your requirements, to me.

anyway, failing sockets, i'd go for named pipes to do this. but that's because i have a Unix mindset; i don't know how well named pipes would do on a non-Unix platform (are they even available in Java?). the most general method is likely RMI, but that is also likely to have the highest overhead and might be severe overkill for your application.

sockets are fairly lightweight, easy to use - not much more trouble than pipes or named pipes - and can be easily scaled from two processes on the same machine to having the processes communicate across machines. (on Unix, sockets can even live in the filesystem like named pipes for localhost-only IPC - but again, i'm not sure how cross-platform compatible that would be.) why would you prefer to avoid them?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!