I have written a daemon in CPP that listens to the serial port and alters a mysql database when necessary. This works fine, but now I need to communicate to the daemon after it has been started. There is an event that happens on average at most once a week that the daemon needs to know about. Hopefully I would be able to communicate to the daemon through php script running on apache on the same machine. I have been reading up about handling signals on linux (very dense), and I have a very rudimentary understanding. What I'm confused about is how to actually send a signal without knowing about the daemon's PID. That made me question if a signal is the right way to do this in the first place. The daemon doesn't need to know any information other than the event occured. Any ideas on how to communicate such an event to a deamon?

Thanks,
Andy

One way might be to enhance the daemon to listen on a socket in another thread and the other program can open the socket and send daemon some information.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.