3 Answers
3

unix sockets are inter-process-communication mechanism that allows bidirectional data exchange between process running on the same machine.

while ip sockets [in special case tcp/ip] are mechanism allowing to communicate between processes over the network. in special case you can use tcp-ip sockets to talk with processes running on the same computer [ by using the loopback interface ].

UNIX domain sockets know that they’re executing on the same system. So they can avoid some checks and operations (like routing) and this makes them faster and lighter than IP sockets. So if you plan to communicate with processes on same host this is a better option than IP sockets.

Edit: as Nils Toedtmann - UNIX domain sockets are subject to file system permissions, while TCP sockets can be controlled only on the packet filter level.

Bronze this answer since it may have been the one to get you 10k. =)
–
WesleyMay 15 '10 at 22:09

1

Maybe add that UNIX domain sockets are subject to file system permissions, while TCP sockets are not. As a result, it is much easier to regulate which users have access to a UNIX domain socket than it is for a TCP socket.
–
Nils ToedtmannFeb 12 at 15:59

I'm not sure if "by definition" your statement is correct! A unix socket can not be used for tcp/ip (remote) communication, only an inet socket can do that. How would you expect a unix socket to route it to another PC?
–
JeachSep 4 '14 at 23:06