Interprocess communication with a Daemon

前端 未结 3 846
隐瞒了意图╮
隐瞒了意图╮ 2021-02-01 08:02

I want to implement a Unix daemon (let\'s call it myUnixd), and want the user to be able to interact with this daemon via the command line, for example:



        
3条回答
  •  感动是毒
    2021-02-01 08:39

    Use Berkeley sockets. Specifically, you can create a "UNIX domain socket" (otherwise known as a "local domain socket," which will create what looks like a text file. Write to the text file to send text to the daemon, read from it to receive text from the daemon. You can implement this with a few function calls.

    If you want something more advanced, you can also use DBus, which offers a more sophisticated interface, but which is more complicated to learn.

提交回复
热议问题