Source of: /manual/en/function.msg-send.php
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.sem.inc";
$setup = array (
'home' =>
array (
0 => 'index.php',
1 => 'PHP Manual',
),
'head' =>
array (
0 => 'UTF-8',
1 => 'en',
),
'this' =>
array (
0 => 'function.msg-send.php',
1 => 'msg_send',
),
'up' =>
array (
0 => 'ref.sem.php',
1 => 'Semaphore Functions',
),
'prev' =>
array (
0 => 'function.msg-remove-queue.php',
1 => 'msg_remove_queue',
),
'next' =>
array (
0 => 'function.msg-set-queue.php',
1 => 'msg_set_queue',
),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);
manual_header();
?>
<div id="function.msg-send" class="refentry">
<div class="refnamediv">
<h1 class="refname">msg_send</h1>
<p class="verinfo">(PHP 4 >= 4.3.0, PHP 5)</p><p class="refpurpose"><span class="refname">msg_send</span> — <span class="dc-title">Send a message to a message queue</span></p>
</div>
<a name="function.msg-send.description"></a><div class="refsect1 description">
<h3 class="title">Description</h3>
<div class="methodsynopsis dc-description">
<span class="type">bool</span> <span class="methodname"><b>msg_send</b></span>
( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$queue</tt></span>
, <span class="methodparam"><span class="type">int</span> <tt class="parameter">$msgtype</tt></span>
, <span class="methodparam"><span class="type"><a href="language.pseudo-types.php#language.types.mixed" class="type mixed">mixed</a></span> <tt class="parameter">$message</tt></span>
[, <span class="methodparam"><span class="type">bool</span> <tt class="parameter">$serialize</tt></span>
[, <span class="methodparam"><span class="type">bool</span> <tt class="parameter">$blocking</tt></span>
[, <span class="methodparam"><span class="type">int</span> <tt class="parameter reference">&$errorcode</tt></span>
]]] )</div>
<p class="para rdfs-comment">
<b>msg_send()</b> sends a <i><tt class="parameter">message</tt></i>
of type
<i><tt class="parameter">msgtype</tt></i>
(which MUST be greater than 0) to
the message queue specified by <i><tt class="parameter">queue</tt></i>
.
</p>
</div>
<a name="function.msg-send.parameters"></a><div class="refsect1 parameters">
<h3 class="title">Parameters</h3>
<p class="para">
</p><dl>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">queue</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
</p>
</dd>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">msgtype</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
</p>
</dd>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">message</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
</p>
</dd>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">serialize</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
The optional <i><tt class="parameter">serialize</tt></i>
controls how the
<i><tt class="parameter">message</tt></i>
is sent. <i><tt class="parameter">serialize</tt></i>
defaults to <b><tt class="constant">TRUE</tt></b> which means that the <i><tt class="parameter">message</tt></i>
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>
</dd>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">blocking</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
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 <i><tt class="parameter">blocking</tt></i>
parameter to <b><tt class="constant">FALSE</tt></b>, in which
case <b>msg_send()</b> will immediately return <b><tt class="constant">FALSE</tt></b> if the
message is too big for the queue, and set the optional
<i><tt class="parameter">errorcode</tt></i>
to <b><tt class="constant">MSG_EAGAIN</tt></b>,
indicating that you should try to send your message again a little
later on.
</p>
</dd>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">errorcode</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
</p>
</dd>
</dl>
<p>
</p>
</div>
<a name="function.msg-send.returnvalues"></a><div class="refsect1 returnvalues">
<h3 class="title">Return Values</h3>
<p class="para">
Returns <b><tt class="constant">TRUE</tt></b> on success or <b><tt class="constant">FALSE</tt></b> on failure.
</p>
<p class="para">
Upon successful completion the message queue data structure is updated as
follows: <i><tt class="parameter">msg_lspid</tt></i>
is set to the process-ID of the
calling process, <i><tt class="parameter">msg_qnum</tt></i>
is incremented by 1 and
<i><tt class="parameter">msg_stime</tt></i>
is set to the current time.
</p>
</div>
<a name="function.msg-send.seealso"></a><div class="refsect1 seealso">
<h3 class="title">See Also</h3>
<p class="para">
</p><ul class="simplelist">
<li class="member"><a href="function.msg-remove-queue.php" class="function" rel="rdfs-seeAlso">msg_remove_queue()</a> - Destroy a message queue</li>
<li class="member"><a href="function.msg-receive.php" class="function" rel="rdfs-seeAlso">msg_receive()</a> - Receive a message from a message queue</li>
<li class="member"><a href="function.msg-stat-queue.php" class="function" rel="rdfs-seeAlso">msg_stat_queue()</a> - Returns information from the message queue data structure</li>
<li class="member"><a href="function.msg-set-queue.php" class="function" rel="rdfs-seeAlso">msg_set_queue()</a> - Set information in the message queue data structure</li>
</ul><p>
</p>
</div>
</div><?php manual_footer(); ?>