Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

socket_recvmsg

Description

The socket_recvmsg of Sockets for PHP read a message.

Syntax

socket_recvmsg(
    Socket $socket,
    array &$message,
    int $flags = 0
): int|false

Parameters

socket

The socket must be a Socket instance previously created by socket_create().

message

The message.

flags

The value of flags can be any combination of the following flags, joined with the binary OR (|) operator.

ConstantDescription
MSG_OOBProcess out-of-band data.
MSG_PEEKReceive data from the beginning of the receive queue without removing it from the queue.
MSG_WAITALLBlock until at least length are received. However, if a signal is caught or the remote host disconnects, the function may return less data.
MSG_DONTWAITWith this flag set, the function returns even if it would normally have blocked.

Return

Returns the number of bytes received, or false if there was an error.

The actual error code can be retrieved by calling socket_last_error(). This error code may be passed to socket_strerror() to get a textual explanation of the error.

HomeMenu