Home > PHP > Function > Streams > stream_socket_recvfrom()

stream_socket_recvfrom()

stream_socket_recvfrom - Receives data from a socket, connected or not

Syntax

string stream_socket_recvfrom (resource $socket, int $length, int $flags, string &$address)

Arguments

  • socket - The remote socket.
  • length - The number of bytes to receive from the socket.
  • flags - The value of flags can be any combination of the following: Possible values for flags STREAM_OOB Process OOB ( out-of-band) data. STREAM_PEEK Retrieve data from the socket, but do not consume the buffer. Subsequent calls to fread() or stream_socket_recvfrom() will see the same data.
  • address - If address is provided it will be populated with the address of the remote socket.

Description

stream_socket_recvfrom() accepts data from a remote socket up to length bytes.

Version

PHP 5

Return value

Returns the read data, as a string