What are the advantages and disadvantages of using Socket in IPC?

I was asked this question in some recent interviews. What are the advantages and disadvantages of using Socket in IPC when there are other ways to implement IPC. Did not find the exact answer.

Any help would be greatly appreciated.

+5
source share
5 answers

Compared to pipes, IPC sockets differ from each other in bidirectional mode, i.e. reading and writing can be performed on the same descriptor. Pipes, unlike sockets, are unidirectional. You must store a couple of descriptors if you want to do both reading and writing.

, , . - , PIPE_BUF , . .

, IPC, . , .

+6

, , . . , IPC , , Linux , POSIX, , Linux.

+1

: , , - .. . , , .

+1

...

  • ( , . ). , .

  • . /, .

  • IPC, . , , , .

  • - , , . , , , .

+1

, . , . , , , , , / .

, ( malloc SHM), - . , , .

, .

The pipes were covered by the Blagovests defendant to this question.

As with such things, I would suggest reading W. Richard Stevens' books on IPC and sockets. There is no better explanation than him! :-)

0
source

All Articles