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.
Constant | Description |
---|---|
MSG_OOB | Process out-of-band data. |
MSG_PEEK | Receive data from the beginning of the receive queue without removing it from the queue. |
MSG_WAITALL | Block until at least length are received. However, if a signal is caught or the remote host disconnects, the function may return less data. |
MSG_DONTWAIT | With 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.
Links
Sockets
- socket_accept
- socket_addrinfo_bind
- socket_addrinfo_connect
- socket_addrinfo_explain
- socket_addrinfo_lookup
- socket_atmark
- socket_bind
- socket_clear_error
- socket_close
- socket_cmsg_space
- socket_connect
- socket_create
- socket_create_listen
- socket_create_pair
- socket_export_stream
- socket_get_option
- socket_getopt
- socket_getpeername
- socket_getsockname
- socket_import_stream
- socket_last_error
- socket_listen
- socket_read
- socket_recv
- socket_recvfrom
- socket_select
- socket_send
- socket_sendmsg
- socket_sendto
- socket_set_block
- socket_set_nonblock
- socket_set_option
- socket_setopt
- socket_shutdown
- socket_strerror
- socket_write
- socket_wsaprotocol_info_export
- socket_wsaprotocol_info_import
- socket_wsaprotocol_info_release