Unix domain sockets介绍

linux/unix中当我们查看netstat -ln(监听的端口时)会发现,列出的信息分为2个部分。
一个是Active internet connections (only servers) 这个一般大家都知道,一个网络服务必然是要监听固定的端口来让客户端来访问和连接的。
一个是Active Unix domain sockets(only servers) 那这种类型的socket又代表什么呢?
A Unix domain socket or IPC socket (inter-process communication socket) is a data communications endpoint for exchanging data between processes executing within the same host operating system. While similar in functionality to named pipes, Unix domain sockets may be created as byte streams or as datagram sequences, while pipes are byte streams only. Processes using Unix domain sockets do not need to share a common ancestry. The programmer’s application interface (API) for Unix domain sockets is similar to that of an Internet socket, but does not use an underlying network protocol for communication. The Unix domain socket facility is a standard component of POSIX operating systems.Unix domain sockets use the file system as address name space. They are referenced by processes as inodes in the file system. This allows two processes to open the same socket in order to communicate. However, communication occurs entirely within the operating system kernel.In addition to sending data, processes may send file descriptors across a Unix domain socket connection using the sendmsg() and recvmsg() system calls.

此篇文章已被阅读3063 次

Add a Comment

邮箱地址不会被公开。 必填项已用*标注