PHP Non-blocking Socket with Server-Client Communication: Part 1

Example Code

In PHP Blocking Socket, I introduced the concept of blocking socket. Now, I would unpack the 'unblocking socket'.

With unblocking sockets, we don't need to "wait" as in blocking sockets, also don't need to wait for the completion of the operation, and can connect the server with more than one client. the following is the example code:

server

client

Example Code Breakdown

Some code is explained in this article PHP Blocking Socket

However, foreach is very inefficient, and I show a better way to do it in PHP non-blocking socket part 2

ссс