Socketpair() in C/Unix

前端 未结 4 1473
野趣味
野趣味 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:05

    Use TCP/IP. While there are other IPC mechanisms available (such as Unix domain sockets and SYSV IPC) you're better off with TCP/IP for many reasons. Here are some:

    1. There are lots of tutorials and other information on the web describing how to do TCP/IP
    2. Modern systems, and especially Linux and *BSD, impose no significant penalty for using TCP/IP compared to, say, Unix domain sockets or even SYSV IPC.
    3. There are a number of libraries and frameworks that you may be able to make use of for applications communicating over TCP/IP.

    The only case where I would not use TCP/IP to communicate between two "programs" is for the case where they are really threads rather than separate programs.

提交回复
热议问题