Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Communication between processes

Tags:

c++

linux

I'm looking for some data to help me decide which would be the better/faster for communication between two independent processes on Linux:

  • TCP
  • Named Pipes

Which is worse: the system overhead for the pipes or the tcp stack overhead?


Updated exact requirements:

  • only local IPC needed
  • will mostly be a lot of short messages
  • no cross-platform needed, only Linux
like image 1000
brandstaetter Avatar asked Dec 04 '22 13:12

brandstaetter


1 Answers

In the past I've used local domain sockets for that sort of thing. My library determined whether the other process was local to the system or remote and used TCP/IP for remote communication and local domain sockets for local communication. The nice thing about this technique is that local/remote connections are transparent to the rest of the application.

Local domain sockets use the same mechanism as pipes for communication and don't have the TCP/IP stack overhead.

like image 159
Richard Pennington Avatar answered Dec 11 '22 16:12

Richard Pennington