简体   繁体   English

Unix套接字:AF_LOCAL与AF_INET

[英]Unix Sockets : AF_LOCAL vs AF_INET

I'm just starting with socket programming in UNIX and I was reading the man pages for the socket system call. 我刚开始在UNIX中使用套接字编程,我正在阅读套接字系统调用的手册页。 I'm a bit confused about the AF_LOCAL argument and when it is used. 我对AF_LOCAL参数及其使用时有点困惑。 The manual just says local communication. 手册只是说当地的沟通。 Wouldn't an AF_INET format also work for local communication? AF_INET格式不适用于本地通信吗?

AF_LOCAL uses UNIX domain sockets which are local to the filesystem and can be used for internal communications. AF_LOCAL使用UNIX域套接字,这些套接字是文件系统的本地套接字,可用于内部通信。 AF_INET is an IP socket. AF_INET是一个IP套接字。 AF_LOCAL will not incur some performance penalties related to sending data over IP. AF_LOCAL不会因通过IP发送数据而产生一些性能损失。 See this old but very nice discussion of the topic. 看到这个主题的旧但非常好的讨论

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 因此,setsockopt可以在AF_UNIX(AF_LOCAL)套接字上超时...未记录/不起作用...选项/替代方法? - So setsockopt for timeouts on AF_UNIX (AF_LOCAL) sockets… undocumented/don't work… options/alternatives? 通过LD_PRELOAD将AF_INET套接字转换为使用AF_UNIX - Converting an AF_INET socket to use AF_UNIX via LD_PRELOAD AF_INET和PF_INET常量之间有什么区别? - What is the difference between AF_INET and PF_INET constants? 如果客户端无法应付(缓冲区++),如何停止写套接字(AF_LOCAL / UNIX,SOCK_STREAM)? - How to stop writing to socket (AF_LOCAL/UNIX, SOCK_STREAM) if client can't cope (buffer++)? socket(PF_INET,SOCK_RAW,AF_INET)使用IGMP吗 - socket(PF_INET, SOCK_RAW, AF_INET) uses IGMP? socket编程中AF_INET和PF_INET有什么区别? - What is the difference between AF_INET and PF_INET in socket programming? 套接字(AF_INET,SOCK_RAW,IPPROTO_UDP)将停止所有发送到正确位置的数据报吗? - will socket(AF_INET, SOCK_RAW, IPPROTO_UDP) stop all the datagrams going to the right places? 将AF_INET分配给sockaddr_in结构的sin_family属性时出现段错误 - Segfault when assigning AF_INET to the sin_family attribute of a sockaddr_in structure 当系统上只有IPv6地址可用时,AF_INET套接字? - AF_INET socket when only IPv6 addresses are available on system? 为什么要比较sa_family,无符号整数,socket.h定义的结构与AF_INET比较 - Why can you compare sa_family, an unsigned integer, a struct defined by socket.h be compared to AF_INET
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM