PHP.nl

msg_receive

msg_receive

Receive a message from a message queue

bool **msg_receive** SysvMessageQueue $queue int $desired_message_type int $received_message_type int $max_message_size mixed $message bool $unserialize int $flags int $error_code
will receive the first message from the

specified of the type specified by . msg_receive``queue``desired_message_type

queueThe message queue.

desired_message_type If is 0, the message from the front of the queue is returned. If is greater than 0, then the first message of that type is returned. If is less than 0, the first message on the queue with a type less than or equal to the absolute value of will be read. If no messages match the criteria, your script will wait until a suitable message arrives on the queue. You can prevent the script from blocking by specifying in the parameter. desired_message_type``desired_message_type``desired_message_type``desired_message_type``MSG_IPC_NOWAIT``flags

received_message_typeThe type of the message that was received will be stored in this parameter.

max_message_size The maximum size of message to be accepted is specified by the ; if the message in the queue is larger than this size the function will fail (unless you set as described below). max_message_size``flags

message The received message will be stored in , unless there were errors receiving the message. message

unserializeIf set to true, the message is treated as though it was serialized using the same mechanism as the session module. The message will be unserialized and then returned to your script. This allows you to easily receive arrays or complex object structures from other PHP scripts, or if you are using the WDDX serializer, from any WDDX compatible source.

  If  is false, the message will be
  returned as a binary-safe string.
 `unserialize`

flags The optional allows you to pass flags to the low-level msgrcv system call. It defaults to 0, but you may specify one or more of the following values (by adding or ORing them together).

 `flags`

error_code If the function fails, the optional will be set to the value of the system errno variable. error_code

return.success

Upon successful completion the message queue data structure is updated as follows: is set to the process-ID of the calling process, is decremented by 1 and is set to the current time. msg_lrpid``msg_qnum``msg_rtime

msg_remove_queue``msg_send``msg_stat_queue``msg_set_queue