The definition of sockets in PHP and the simple introduction of where to use them

Source: Internet
Author: User
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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.