http://blog.csdn.net/hguisu/article/details/7445768
How processes communicate across the network
The concept of process communication originated from a stand-alone system. Since each process operates within its own address range, it is guaranteed that two communication
and coordinated work between the processes, the operating system provides the corresponding facilities for process communication, such as
UNIX BSD: Piping (pipe), named pipe (named pipe) soft interrupt signal (signal)
UNIX System V has: message, shared memory, and semaphore (semaphore).
They are limited to communicating between native processes. Inter-network process communication is to solve the problem of communication between different host processes (the same machine process communication can be regarded as a special case). To do this, the first thing to solve is the inter-network process identification problem. On the same host, different processes can be uniquely identified by the process ID. However, in the network environment, the process number assigned by each host individually cannot uniquely identify the process. For example, host A is assigned to a process number 5, and the number 5th process can exist in machine B, so the phrase "process 5th" is meaningless. Second, the operating system supports a large number of network protocols, different protocols work in different ways, address format is also different. Therefore, the inter-network process communication also solves the problem of multi-protocol recognition.
In fact, the TCP/IP protocol family has helped us solve this problem, the network layer "IP address " can uniquely identify the host in the network, and the Transport layer " protocol + port " can uniquely identify the host application (process). By using triples (IP address, Protocol, port), the process of the network can be identified, and the process communication in the network can use this flag to interact with other processes.
Applications that use the TCP/IP protocol typically use the application programming interface: The UNIX BSD socket (socket) and the Unix System v Tli (already obsolete) to enable communication between network processes. For now, almost all applications are sockets, and now it's the network era, where process communication is ubiquitous, and that's why I say "everything is a socket."
Linux Socket Programming Detailed