<HTML ><HEAD ><TITLE >msg_send</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="PHP Manual" HREF="index.html"><LINK REL="UP" TITLE="Semaphore, Shared Memory and IPC Functions" HREF="ref.sem.html"><LINK REL="PREVIOUS" TITLE="msg_remove_queue" HREF="function.msg-remove-queue.html"><LINK REL="NEXT" TITLE="msg_set_queue" HREF="function.msg-set-queue.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.msg-remove-queue.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.msg-set-queue.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.msg-send" ></A >msg_send</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN82461" ></A ><P > (PHP 4 >= 4.3.0)</P >msg_send -- Send a message to a message queue </DIV ><DIV CLASS="refsect1" ><A NAME="AEN82464" ></A ><H2 >Description</H2 >bool <B CLASS="methodname" >msg_send</B > ( int queue, int msgtype, mixed message [, bool serialize [, bool blocking [, int errorcode]]])<BR ></BR ><P > <B CLASS="function" >msg_send()</B > sends a <TT CLASS="parameter" ><I >message</I ></TT > of type <TT CLASS="parameter" ><I >msgtype</I ></TT > (which MUST be greater than 0) to a the message queue specified by <TT CLASS="parameter" ><I >queue</I ></TT >. </P ><P > If the message is too large to fit in the queue, your script will wait until another process reads messages from the queue and frees enough space for your message to be sent. This is called blocking; you can prevent blocking by setting the optional <TT CLASS="parameter" ><I >blocking</I ></TT > parameter to <TT CLASS="constant" ><B >FALSE</B ></TT >, in which case <B CLASS="function" >msg_send()</B > will immediately return <TT CLASS="constant" ><B >FALSE</B ></TT > if the message is too big for the queue, and set the optional <TT CLASS="parameter" ><I >errorcode</I ></TT > to EAGAIN, indicating that you should try to send your message again a little later on. </P ><P > The optional <TT CLASS="parameter" ><I >serialize</I ></TT > controls how the <TT CLASS="parameter" ><I >message</I ></TT > is sent. <TT CLASS="parameter" ><I >serialize</I ></TT > defaults to <TT CLASS="constant" ><B >TRUE</B ></TT > which means that the <TT CLASS="parameter" ><I >message</I ></TT > is serialized using the same mechanism as the session module before being sent to the queue. This allows complex arrays and objects to be sent to other PHP scripts, or if you are using the WDDX serializer, to any WDDX compatible client. </P ><P > Upon successful completion the message queue data structure is updated as follows: <TT CLASS="parameter" ><I >msg_lspid</I ></TT > is set to the process-ID of the calling process, <TT CLASS="parameter" ><I >msg_qnum</I ></TT > is incremented by 1 and <TT CLASS="parameter" ><I >msg_stime</I ></TT > is set to the current time. </P ><P > See also: <A HREF="function.msg-remove-queue.html" ><B CLASS="function" >msg_remove_queue()</B ></A >, <A HREF="function.msg-receive.html" ><B CLASS="function" >msg_receive()</B ></A >, <A HREF="function.msg-stat-queue.html" ><B CLASS="function" >msg_stat_queue()</B ></A > and <A HREF="function.msg-set-queue.html" ><B CLASS="function" >msg_set_queue()</B ></A >. </P ><P > This function was introduced in PHP 4.3.0 (not yet released). </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.msg-remove-queue.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.msg-set-queue.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >msg_remove_queue</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.sem.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >msg_set_queue</TD ></TR ></TABLE ></DIV ></BODY ></HTML >