When phpsocket data is waiting, php is stuck with a server program. Multithreading. Use php to connect through socket. The server sends and receives data synchronously. Thread pool.
The problem is. After I use php to connect to the server program. Wait for a while. Data can be returned.
At this time. Php cannot be parsed. The server program can process the socket request normally, but the entire php is stopped and must wait until the data is returned. After receiving data. To continue parsing the php file.
Is there any way to stop php from all the time and wait until the data is returned.
Reply to discussion (solution)
Since it is synchronous sending and receiving, of course we have to wait.
For web programs, ajax is used to asynchronously call the php socket program to prevent page termination.
For the CLI program, add the libevent extension of php or the pthreads extension of multithreading.
The current page is not stopped. But .. The entire php is stopped... Until the data is received .. Php can continue parsing.
Synchronization will certainly have to wait, unless you use asynchronous.