If the data sent by the server always exceeds the maximum number of bytes that the client can bear at one time, how can the client determine that the received data is complete without performing the socket_read operation? How much data does the server return? Composed of /n. I tried using a while loop to read the server's data, but there was a problem with the operation.
phpcn_u15822017-05-16 13:11:13
If it is a short link, use socket_set_nonblock to set the socket link to non-blocking, and then execute socket_read in a loop. When the return value length is 0, jump out of the loop and the reception ends (this method may cause problems in some cases).
It is best to specify the data length on the server side so that there will be no errors.