tcp socket/ unix socket

tcp socket/ unix socket

A UNIX socket is an inter-process communication mechanism that allows bidirectional data exchange between processes running on the same machine.

IP sockets (especially TCP/IP sockets) are a mechanism allowing communication between processes over the network. In some cases, 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); which makes them faster and lighter than IP sockets. So if you plan to communicate with processes on the same host, this is a better option than IP sockets.

Edit: As per Nils Toedtmann's comment: UNIX domain sockets are subject to file system permissions, while TCP sockets can be controlled only on the packet filter level.

主要是在redis的配置上遇到该情况

需要开启redis.conf的unixsocket兼容配置,区别在于开启本地进程间更快捷的数据交互通信,可以基于本地的文件系统io实现机制,tcp/ip socket则必须基于网络发包机制

你可能感兴趣的:(网络编程)