PHP Manual

PHP function socket_get_status()

11. 09. 2019

Obsah článku

Availability in versions: `PHP 4.3.0`

&Alias; stream_get_meta_data Retrieves header/meta data from streams/file pointers


Parameter Data type Default value Note
$stream resource not The stream can be any stream created by fopen, fsockopen and pfsockopen.

Return values


The result array contains the following items:

timed_out (bool) - true if the stream timed out while waiting for data on the last call to fread or fgets.

blocked (bool) - true if the stream is in blocking IO mode. See stream_set_blocking.

eof (bool) - true if the stream has reached end-of-file. Note that for socket streams this member can be true even when unread_bytes is non-zero. To determine if there is more data to be read, use feof instead of reading this item.

unread_bytes (int) - the number of bytes currently contained in the PHP's own internal buffer.

You shouldn't use this value in a script.

stream_type (string) - a label describing the underlying implementation of the stream.

wrapper_type (string) - a label describing the protocol wrapper implementation layered over the stream. See for more information about wrappers.

wrapper_data (mixed) - wrapper specific data attached to this stream. See for more information about wrappers and their wrapper data.

filters (array) - and array containing the names of any filters that have been stacked onto this stream. Documentation on filters can be found in the Filters appendix.

mode (string) - the type of access required for this stream (see Table 1 of the fopen() reference)

seekable (bool) - whether the current stream can be seeked.

uri (string) - the URI/filename associated with this stream.

Other resources

Official socket-get-status documentation

Jan Barášek   Více o autorovi

Autor článku pracuje jako seniorní vývojář a software architekt v Praze. Navrhuje a spravuje velké webové aplikace, které znáte a používáte. Od roku 2009 nabral bohaté zkušenosti, které tímto webem předává dál.

Rád vám pomůžu:

Související články


V jiných jazycích

All systems normal.