tcp socket/ unix socket

本文介绍了TCP Socket和Unix Socket。Unix Socket用于同一机器进程间双向数据交换,比IP Socket更快更轻;IP Socket用于网络进程间通信。在Redis配置中,开启Unix Socket兼容配置可实现本地进程间更快捷通信,而TCP/IP Socket基于网络发包。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

tcp socket/ unix socket

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则必须基于网络发包机制

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值