socket_read
socket_read
Reads a maximum of length bytes from a socket
**socket_read** Socket $socket int $length int $mode
The function reads from the instance
created by the
or
functions.
socket_read``Socket``socket``socket_create``socket_accept
socket
A instance created with
or .
Socket``socket_create``socket_accept
length
The maximum number of bytes read is specified by the
parameter. Otherwise you can use
, ,
or to end reading (depending on the
parameter, see below).
length``\r``\n``\0``mode
mode
Optional parameter is a named constant:
`mode`- (Default) - use the system function. Safe for reading binary data. `PHP_BINARY_READ``recv()`
-
-
reading stops at or .
PHP_NORMAL_READ``\n``\rreturns the data as a string on success, or false on error (including if the remote host has closed the connection). The error code can be retrieved with . This code may be passed to to get a textual representation of the error.
socket_read``socket_last_error``socket_strerror
-
Opmerking: > returns a zero length string ("") when there is no more data to read.
socket_read
socket_accept``socket_bind``socket_connect``socket_listen``socket_last_error``socket_strerror``socket_write