MSG_WAITALL Block until at least len are received. However, if a signal is caught or the remote host disconnects, the function may return less data. MSG_DONTWAIT With this flag set, the function returns even if it would normally have blocked.
The blocking ability that allows the function to wait until data is received, of course, using socket_recv, but using socket_read, it is assumed that the bytes are already received and are not waiting, so it cannot return anything:
Note: socket_read() returns a zero length string ("") when there is no more data to read.
source share