What man netstat sees
Active Internet connections (TCP, UDP, raw)
The protocol (tcp, udp, raw) used by the socket.
Active UNIX domain Sockets
The protocol (usually unix) used by the socket.
What does w/o server mean?
Active Internet connections (w/o servers)
Active UNIX domain sockets (w/o servers)
-P, -- program
Show the PID and name of the program to which each socket belongs.
-L, -- listening
Show only listening sockets. (These are omitted by default .)
-A, -- all
Show both listening and non-listening sockets. With the -- interfaces option, show interfaces that are not marked
The Unix domain protocol is not an actual protocol family, but a method for executing Client/Server Communication on a single host. It is actually an IPC (InterProcess Communication) one type of inter-process communication. By the way,
Inter-process communication can be implemented in the following ways: pipelines (Half Duplex), operating OS (name management), Stream pipelines (Full Duplex), command Stream pipelines, message queues, semaphores, shared memory, and APIs, stream
IPC is a standard Unix communication mechanism. Classification LPC (local) and RPC (network)
The first two types are usually restricted to inter-process communication on the same host. The last two types can be inter-process communication on different hosts. Different from network communication, both parties in the network confirm that the IP address and port number are required, while the two processes on the same machine do not need to be so troublesome,
If you have written an example of pipeline communication, it is similar to a pipeline. It must be defined as a file for Communication (not an existing file in the system)
Unix provides two types of interfaces: byte stream set interface and datagram set interface. There are three reasons for using the Unix domain interface:
1. In the implementation from Berkeley, Unix domain interface is usually twice as fast as TCP interface located on the same host at both ends of the communication.
2. the Unix domain interface can be used to transmit descriptive words between different processes on the same host.
3. The new implementation of the Unix domain interface provides the customer's creden (user ID and group ID) to the server, so as to provide additional security check measures.
These two days ago, I was looking at the implementation of UNIX socket. I thought about the difference between its performance and TCP/IP. If its performance is not as good as TCP/IP, so there is no significance for him.
I wrote a simple echo server, tested several sets of data, and found that its performance is indeed higher than that of TCP/IP, the numeric value is twice that mentioned in UNIX network programming.
Socket is the network, while ordinary files are the disk IO.
To bind different types of I/O to the corresponding file descriptor, different initialization functions are required. File I/o and network I/o
Common files use the open function to specify the corresponding file path, and the operating system can find the corresponding file system type through the path, such as ext4, fat, and so on.
The network is initialized through the socket function, and the socket function finds the corresponding network protocol stack through (domain, type, protocol), such as TCP/IP and UNIX.
Therefore, for network-related calls, such as listen, connect, and bind, the first step is to find the corresponding kernel socket structure through the file descriptor, and then perform corresponding operations.
In the socket layer, the kernel implements an interface function, which may also be called the bridge pattern ).