Reading

socket_read($r, $i1 [,$i2=PHP_BINARY_READ]) reads a maximum of $i1 bytes from the socket $r and returns the string read. If $i2 is PHP_NORMAL_READ, reading stops at \n or \r. FALSE is returned on error.

socket_recv
($r, &$s, $i1, $i2) retrieves $i1 bytes of data from the socket $r and stores it into $s.
socket_recvfrom($r, &$s1, $i1, $i2, &$s2 [,$i3]) retrieves $i1 bytes of data from address $s2 on port $i3 through socket $r and stores it in $s1.
socket_ recvmsg($r, $s [,$i2]) reads message $s on socket $r. These functions return the number of bytes received, or FALSE on error. $i2 is a combination of:
MSG_OOB Processes out-of-band data.
MSG_PEEK Receives data from the beginning of the queue without removing it from the queue.
MSG_WAITALL Blocks until at least $i bytes are received. If a signal is caught or the remote host disconnects, the function may return less data.
MSG_DONTWAIT Returns even if it would normally have blocked.