Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between pipe and socket?

Tags:

c++

windows

Both can be used for communicating between different processes,

what's the difference?

like image 298
wamp Avatar asked Aug 19 '10 03:08

wamp


2 Answers

(Off the top of my head)

Pipe: A tube with a small bowl at one end; used for smoking tobacco

Socket: Receptacle where something (a pipe, probe or end of a bone) is inserted

Anyways:

"A major difference between pipes and sockets is that pipes require a common parent process to set up the communications channel. A connection between sockets can be set up by two unrelated processes, possibly residing on different machines."

like image 76
VoodooChild Avatar answered Oct 05 '22 10:10

VoodooChild


(Shamelessly cribbed from http://www.perlmonks.org/?node_id=180842)

Pipes are fast and reliable, because they are implemented in memory on a single host where both communicating processes run. Sockets are slower and less reliable, but are much more flexible since they allow communication between processes on different hosts.

like image 25
Will A Avatar answered Oct 05 '22 10:10

Will A