php man page for socket_read

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 socket

SYNOPSIS
string socket_read (resource $socket, int $length, [int $type = PHP_BINARY_READ])
DESCRIPTION
The function socket_read(3) reads from the socket resource $socket created by the socket_create(3) or socket_accept(3) functions.
PARAMETERS
o $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 VALUES
socket_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 ALSO
socket_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)
Related Man Pages
accept(2) - ultrix
recv(2) - osf1
fgets(3) - php
fread(3) - php
socket_set_option(3) - php
Similar Topics in the Unix Linux Community
AWK - Line length validation
reading reading data from webpage
unable to get end of file while reading HTTP data from socket
Strange character added when reading to buffer with length of 12
PHP: How to use socket_select() and socket_read() correctly