Unix Domain Socket: Using datagram communication between one server process and several client processes

前端 未结 7 1257
野趣味
野趣味 2020-12-12 17:25

I would like to establish an IPC connection between several processes on Linux. I have never used UNIX sockets before, and thus I don\'t know if this is the correct approach

7条回答
  •  自闭症患者
    2020-12-12 17:42

    Wouldn't it be easier to use shared memory or named pipes? A socket is a connection between two processes (on the same or a different machine). It isn't a mass communication method.

    If you want to give something to multiple clients, you create a server that waits for connections and then all the clients can connect and it gives them the information. You can accept concurrent connections by making the program multi-threaded or by forking processes. The server establishes multiple socket-based connections with multiple clients, rather than having one socket that multiple clients connect to.

提交回复
热议问题