This article brings you the content is about the definition of the socket in PHP and the use of a simple introduction to the scene, there is a certain reference value, the need for a friend can refer to, I hope you have some help.
Definition of sockets && usage scenarios:
(a) Socket usage scenario:
For example: The browser process communicates with the Web server process;
such as: QQ process and friends QQ process communication;
(ii) Local process communication && process communication on the network:
(1) Local process communication:
The local interprocess communication (IPC) is available in a number of ways, but can be summarized in the following 3 categories:
1. Message delivery (pipeline, FIFO, Message Queuing)
2. Synchronization (mutex, condition variable, read/write lock, file and write record lock, semaphore)
3. Shared memory (anonymous and named)
(3) Identify a process:
A process can be uniquely identified locally through the process PID, but this is not feasible in the network.
The IP address of the network layer uniquely identifies the host in the network, and the Transport layer's Protocol + port uniquely identifies the application (process) in the host. This allows you to identify the process of the network using triples (IP addresses, protocols, ports).
(2) Process communication on the network:
Applications that use the TCP/IP protocol typically use the application programming interface: The UNIX BSD socket (socket).
(iii) Definition of socket:
Sockets originate from UNIX, and one of Unix/linux's basic philosophies is that "all files" can be manipulated using the "open open–> Read and write write/read–> close" mode. My understanding is that the socket is an implementation of the pattern, the socket is a special kind of file, some socket function is the operation of it (read/write Io, open, close)