954,518 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

IPC samples needed in java?

Hi buddies,
I m in need of IPC sample to communicate between two applications.I hav to start one app from another and I want to know whether the second is running or not.If any samples on Interprocess communication,please let me know.

Thanks in advance.

ramjeev
Junior Poster in Training
65 posts since Mar 2008
Reputation Points: 8
Solved Threads: 0
 

If you have written both programs yourself you can use java Sockets to communicate. Take a look at http://java.sun.com/docs/books/tutorial/networking/sockets/clientServer.html

When the program starts you create a thread that runs the servercode, which listens to a socket. All it does is when it receives incoming connections; accept it, reply, close it.

When you want to check if the program is running, try to send a message on the same port the program is listening on. If there's no reply, start the program, if it replies it's already running :)

-vidaj-

vidaj
Junior Poster in Training
68 posts since Jul 2007
Reputation Points: 45
Solved Threads: 14
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You