Query: socket_read
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
SOCKET_READ(3) 1 SOCKET_READ(3) socket_read - Reads a maximum of length bytes from a socketSYNOPSISstring socket_read (resource $socket, int $length, [int $type = PHP_BINARY_READ])DESCRIPTIONThe function socket_read(3) reads from the socket resource $socket created by the socket_create(3) or socket_accept(3) functions.PARAMETERSo $socket - A valid socket resource created with socket_create(3) or socket_accept(3). o $length - The maximum number of bytes read is specified by the $length parameter. Otherwise you can use , , or to end reading (depending on the $type parameter, see below). o $type - Optional $type parameter is a named constant: o PHP_BINARY_READ (Default) - use the system recv() function. Safe for reading binary data. o PHP_NORMAL_READ - reading stops at or .RETURN VALUESsocket_read(3) returns 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 socket_last_error(3). This code may be passed to socket_strerror(3) to get a textual representation of the error. Note socket_read(3) returns a zero length string ("") when there is no more data to read.SEE ALSOsocket_accept(3), socket_bind(3), socket_connect(3), socket_listen(3), socket_last_error(3), socket_strerror(3), socket_write(3). PHP Documentation Group SOCKET_READ(3)