Advertisement

Communicating with a Linux daemon in Java

Started by April 12, 2003 08:55 AM
1 comment, last by usser 21 years, 5 months ago
I am writing a server for my game in Java. Lets say i launched my daemon and it is up and running. How would i communicate with the thread? What is the standard way of doing this in unix, given i have the daemons pid? How would i do this in Java?
What do you mean by communicating?

There are standard signals for processes which you can use to send certain actions and handle them depending on the signal number. There are 2 (I think) user defined signal numbers, so if your goal it to have an admin or user just send some signal to the Java program and act, you could use those.

If you''re looking for something more robust, you could use local Unix sockets or network sockets. You could also use named pipes. Unix has facilities to create these in a shell.

For signals: ''man signal''
For sockets: ''man socket'' (Look at AF_UNIX)
For Named Pipes: ''man 2 mkfifo''

For named pipes by the shell: ''man mkfifo''

I never got into Java outside of a random CS course I took a bit ago, but I''m sure they have facilities to work with FIFOs (Named Pipes) and sockets.

Interim

Advertisement
Just to clarify on the communication part:

By communication i mean mainly internal communication with the server, i.e a second program that can be used to monitor the server and query it for a wide variety of variables.

This topic is closed to new replies.

Advertisement