Php blocking function-php Tutorial

Source: Internet
Author: User
Tags socket blocking
There is a demand for php blocking functions. a. php cannot end after execution is complete and needs to be blocked. B. php then communicates with the external and transmits the external data to a. php in the blocking state.
Then it is better not to use socket blocking on the network.


Reply to discussion (solution)

We recommend that you do not do this. you use a parameter in a. php for identification, for example:
Access a. php first? Type = 0;
Access B. php again;
Finally, access a. php? Type = 1;

Your needs cannot be fulfilled!


Your needs cannot be fulfilled!

Ask for help .. Why cannot this requirement be met?

The moderator is right. Since a is blocked, how can he perform the received action?
A can only perform listening, not blocking

The moderator is right. Since a is blocked, how can he perform the received action?
A can only perform listening, not blocking

Okay. It may not have been too clear. Is it the blocking in the listener status?

In an http session, php is used as the working program of the http server.
If php is suspended, the http server will not terminate this session because it has not been returned.
Because http is a stateless protocol, the session cannot be reimported. (I want to interject, but I don't know where to plug in)

I guess you are planning to push the server.
This application is closely related to browsers, so php is not yet supported (of course, some server languages are already supported)
We can see that such php applications require socket as servers. And you don't want to do that.

In an http session, php is used as the working program of the http server.
If php is suspended, the http server will not terminate this session because it has not been returned.
Because http is a stateless protocol, the session cannot be reimported. (I want to interject, but I don't know where to plug in)

I guess you are planning to push the server.
This application is closely related to browsers, so php is not yet supported (of course, some server languages are already supported)
Yes ......

Ask the moderator weakly. Is it possible to use pcntl or popen for inter-process communication and blocking?
However, pcntl seems somewhat unstable on the web. Popen feels too high and dangerous.

So are you planning to modify the php kernel or the apache kernel?
If you have this capability, you will naturally be able

So are you planning to modify the php kernel or the apache kernel?
If you have this capability, you will naturally be able

It seems that only socket exists. thanks to the moderator.

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.