Socketpair() in C/Unix

前端 未结 4 1444
野趣味
野趣味 2020-11-29 19:41

I have 2 applications on the same system that I need to communicate back and forth. From my research I believe this is called Inter Process Communication and the use of sock

4条回答
  •  执念已碎
    2020-11-29 20:10

    For communicating between two processes, yes, Inter Process Communication or IPC is what you should look for. Sockets are just one of the methods for communicating and is useful if you have to implement one-to-many connection. Means, one server process which communicates with many client processes in a request-response fashion. As you are a newbie to IPC, it is understandable that socket addresses and the details involved might look difficult to grasp. (Though you will find them easy in due time :-))

    For your problem, I suggest you use simpler IPC mechanisms like Pipe, FIFO, Message Queue. I am not sure how you came to the conclusion to use socketpair. Since you have not mentioned anything around the design or kind of IPC you need AND bassed on usage level I strongly recommend to look into Pipe or FIFO sample codes in some book or internet. They should look way easier to implement and work faster than sockets.

提交回复
热议问题