/manual/www.php.ru/manual/function.msg-receive.html
HTML | 653 lines | 473 code | 124 blank | 56 comment | 0 complexity | da90548dff160c2ea7694aa24a8fda61 MD5 | raw file
- <!--
- HTML dropped by Zend Guard Compressor 4.2
- php.ru team: mz, az, yuri, vb, cyxapuk, 440hz, administrator
- 2004-2007 (c) expi-web.com
- 2007-2008 (c) odware.com
- 0101-1010 (с) 440hz
- 2b|~2b=?
- -->
- <!-- EHOT тут всё пожрал ! -->
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <html>
- <head>
- <link rel="alternate" type="application/rss+xml" title="php.ru/forum - последние сообщения" href="http://www.php.ru/forum/rss.php">
- <link rel="SHORTCUT ICON" href="http://www.php.ru/favicon.ico" />
- <META name="description" content="php.ru - форум PHP программистов, поиск по всем ресурсам сети, посвященным php">
- <meta http-equiv="description" content="php.ru - форум PHP программистов, поиск по всем ресурсам сети, посвященным php">
- <META name="keywords" content="php, php5, apache, mysql, session">
- <meta http-equiv="keywords" content="php, php5, apache, mysql, session">
- <title>php.ru - msg_receive</title>
- <LINK REL="stylesheet" TYPE="text/css" HREF="http://www.php.ru/index.css">
- <script language="JavaScript" src="http://www.php.ru/ajax/ajax.js"></script>
- </head>
- <body>
- <table height='100%' width='100%' cellspacing='0' cellpadding='0'>
- <tr height='99%' valign='top'>
- <td align='center'>
-
- <table style='margin-top: 4px' width=100% cellspacing=0 cellpadding=3>
- <tr>
- <td>PHP - <a href="http://ru.wikipedia.org/wiki/%D0%A0%D0%B5%D0%BA%D1%83%D1%80%D1%81%D0%B8%D0%B2%D0%BD%D1%8B%D0%B9_%D0%B0%D0%BA%D1%80%D0%BE%D0%BD%D0%B8%D0%BC" target=_blank class=lnk>рекурсивный акроним</a> словосочетания «<a href="/manual/introduction.html" class=lnk>PHP: Hypertext Preprocessor</a>»</td>
- </tr>
- </table>
- <script language="JavaScript" src="http://www.php.ru/ajax/subsys_ajax.js"></script>
- <!--
- commet by 440hz
- 20.10.2007
- <script language="JavaScript" src="http://www.php.ru/ajax/pu_search.js"></script>
- -->
- <script language="JavaScript" src="http://www.php.ru/ajax/cz.js?a=b"></script>
- <table style='margin-top: 5px' width=100% bgcolor=#9999cc cellspacing=0 cellpadding=0 border=0>
- <form name=SEARCH method=GET action="http://www.php.ru/search/?SID=uh0qurxoqgdzizap" onsubmit="return puSubmit();">
- <input type=hidden name=PAGE value=1>
- <tr>
- <td width='1' valign='middle'>
- <a href='/'><img src="http://www.php.ru/;-)/logo.gif" width=133 height=93 alt="php" border=0 hspace=10 vspace=0></a>
- </td>
- <td width='100%' valign='middle'>
- <!--
-
- commet by 440hz
- 20.10.2007
- <div id='pu_search' class='pu_search'></div>
- <div id='pu_search_description' class='pu_search_decription'></div>
-
- -->
- <input type=text style='width:99%; margin: 10px' maxlength='200' name='QS' class='in' id='query' autocomplete='off' value="" />
- </td>
- </tr>
- <tr bgcolor='#666699' valign='middle'>
- <td style='border-top: 1px solid #333366;'><br /></td>
- <td style='border-top: 1px solid #333366;'><div style="padding: 4px 4px 4px 10px; height: 24px; color: #CCCCFF;" id="stat">Хто там?<script>doLoadCZ('stat','stat');</script></div></td>
- </tr>
- </form>
- </table>
- <table id="menu" cellspaciong=0 cellpadding=3>
- <tr>
- <td><a href="/" class=current>Главная</a></td>
- <td><a href="/download/" class=current>Скачать</a></td>
- <td><a href="/doc/" class=current>Документация</a></td>
- <td><a href="/forum/" class=current>Форум</a></td>
- <td width=100% align=right><a href="/phpinfo.html" class=current>phpinfo()</a></td>
- </tr>
- </table>
-
- <!-- AdRiver code START. Type:728x90 Site: php.ru PZ: 0 BN: 1 -->
- <script language="javascript" type="text/javascript"><!--
- var RndNum4NoCash = Math.round(Math.random() * 1000000000);
- var ar_Tail='unknown'; if (document.referrer) ar_Tail = escape(document.referrer);
- document.write(
- '<iframe src="http://ad.adriver.ru/cgi-bin/erle.cgi?'
- + 'sid=148680&bn=1&target=blank&bt=36&pz=0&rnd=' + RndNum4NoCash + '&tail256=' + ar_Tail
- + '" frameborder=0 vspace=0 hspace=0 width=728 height=90 marginwidth=0'
- + ' marginheight=0 scrolling=no></iframe>');
- //--></script>
- <noscript>
- <a href="http://ad.adriver.ru/cgi-bin/click.cgi?sid=148680&bn=1&bt=36&pz=0&rnd=1525626915" target=_blank>
- <img src="http://ad.adriver.ru/cgi-bin/rle.cgi?sid=148680&bn=1&bt=36&pz=0&rnd=1525626915" alt="-AdRiver-" border=0 width=728 height=90></a>
- </noscript>
- <!-- AdRiver code END -->
- <table width='100%' cellspacing='0' cellpadding='0'>
- <tr valign='top'>
- <td width=100%><div style="margin: 10px 10px 10px 50px;"><center><div style="width: 800px; text-align: left"><DIV
- CLASS="NAVHEADER"
- ><TABLE
- SUMMARY="Header navigation table"
- WIDTH="100%"
- BORDER="0"
- CELLPADDING="0"
- CELLSPACING="0"
- ><TR
- ><TH
- COLSPAN="3"
- ALIGN="center"
- >Руководство по PHP</TH
- ></TR
- ><TR
- ><TD
- WIDTH="10%"
- ALIGN="left"
- VALIGN="bottom"
- ><A
- HREF="function.msg-get-queue.html"
- ACCESSKEY="P"
- >Пред.</A
- ></TD
- ><TD
- WIDTH="80%"
- ALIGN="center"
- VALIGN="bottom"
- ></TD
- ><TD
- WIDTH="10%"
- ALIGN="right"
- VALIGN="bottom"
- ><A
- HREF="function.msg-remove-queue.html"
- ACCESSKEY="N"
- >След.</A
- ></TD
- ></TR
- ></TABLE
- ><HR
- ALIGN="LEFT"
- WIDTH="100%"></DIV
- ><H1
- ><A
- NAME="function.msg-receive"
- ></A
- >msg_receive</H1
- ><DIV
- CLASS="refnamediv"
- ><A
- NAME="AEN163695"
- ></A
- ><P
- > (PHP 4 >= 4.3.0, PHP 5)</P
- >msg_receive --
- Receive a message from a message queue
- </DIV
- ><DIV
- CLASS="refsect1"
- ><A
- NAME="AEN163698"
- ></A
- ><H2
- >Description</H2
- >bool <B
- CLASS="methodname"
- >msg_receive</B
- > ( resource queue, int desiredmsgtype, int &msgtype, int maxsize, mixed &message [, bool unserialize [, int flags [, int &errorcode]]] )<BR
- ></BR
- ><P
- > <B
- CLASS="function"
- >msg_receive()</B
- > will receive the first message from the
- specified <VAR
- CLASS="parameter"
- >queue</VAR
- > of the type specified by
- <VAR
- CLASS="parameter"
- >desiredmsgtype</VAR
- >.
- The type of the message that was received will be stored in
- <VAR
- CLASS="parameter"
- >msgtype</VAR
- >.
- The maximum size of message to be accepted is specified by the
- <VAR
- CLASS="parameter"
- >maxsize</VAR
- >; if the message in the queue is larger
- than this size the function will fail (unless you set
- <VAR
- CLASS="parameter"
- >flags</VAR
- > as described below).
- The received message will be stored in <VAR
- CLASS="parameter"
- >message</VAR
- >,
- unless there were errors receiving the message, in which case the
- optional <VAR
- CLASS="parameter"
- >errorcode</VAR
- > will be set to the value of the
- system errno variable to help you identify the cause.
- </P
- ><P
- > If <VAR
- CLASS="parameter"
- >desiredmsgtype</VAR
- > is 0, the message from the front
- of the queue is returned. If <VAR
- CLASS="parameter"
- >desiredmsgtype</VAR
- > is
- greater than 0, then the first message of that type is returned.
- If <VAR
- CLASS="parameter"
- >desiredmsgtype</VAR
- > is less than 0, the first
- message on the queue with the lowest type less than or equal to the
- absolute value of <VAR
- CLASS="parameter"
- >desiredmsgtype</VAR
- > 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 <TT
- CLASS="constant"
- ><B
- >MSG_IPC_NOWAIT</B
- ></TT
- > in the
- <VAR
- CLASS="parameter"
- >flags</VAR
- > parameter.
- </P
- ><P
- > <VAR
- CLASS="parameter"
- >unserialize</VAR
- > defaults to <TT
- CLASS="constant"
- ><B
- >TRUE</B
- ></TT
- >; if it is set to
- <TT
- CLASS="constant"
- ><B
- >TRUE</B
- ></TT
- >, 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 <VAR
- CLASS="parameter"
- >unserialize</VAR
- > is <TT
- CLASS="constant"
- ><B
- >FALSE</B
- ></TT
- >, the message will be
- returned as a binary-safe string.
- </P
- ><P
- > The optional <VAR
- CLASS="parameter"
- >flags</VAR
- > 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).
- <DIV
- CLASS="table"
- ><A
- NAME="AEN163751"
- ></A
- ><P
- ><B
- >Таблица 1. Flag values for msg_receive</B
- ></P
- ><TABLE
- BORDER="1"
- CLASS="CALSTABLE"
- ><COL><COL><TBODY
- ><TR
- ><TD
- ><TT
- CLASS="constant"
- ><B
- >MSG_IPC_NOWAIT</B
- ></TT
- ></TD
- ><TD
- >If there are no messages of the
- <VAR
- CLASS="parameter"
- >desiredmsgtype</VAR
- >, return immediately and do not
- wait. The function will fail and return an integer value
- corresponding to ENOMSG.
- </TD
- ></TR
- ><TR
- ><TD
- ><TT
- CLASS="constant"
- ><B
- >MSG_EXCEPT</B
- ></TT
- ></TD
- ><TD
- >Using this flag in combination with a
- <VAR
- CLASS="parameter"
- >desiredmsgtype</VAR
- > greater than 0 will cause the
- function to receive the first message that is not equal to
- <VAR
- CLASS="parameter"
- >desiredmsgtype</VAR
- >.</TD
- ></TR
- ><TR
- ><TD
- ><TT
- CLASS="constant"
- ><B
- >MSG_NOERROR</B
- ></TT
- ></TD
- ><TD
- > If the message is longer than <VAR
- CLASS="parameter"
- >maxsize</VAR
- >,
- setting this flag will truncate the message to
- <VAR
- CLASS="parameter"
- >maxsize</VAR
- > and will not signal an error.
- </TD
- ></TR
- ></TBODY
- ></TABLE
- ></DIV
- >
- </P
- ><P
- > Upon successful completion the message queue data structure is updated as
- follows: <VAR
- CLASS="literal"
- >msg_lrpid</VAR
- > is set to the process-ID of the
- calling process, <VAR
- CLASS="literal"
- >msg_qnum</VAR
- > is decremented by 1 and
- <VAR
- CLASS="literal"
- >msg_rtime</VAR
- > is set to the current time.
- </P
- ><P
- > <B
- CLASS="function"
- >msg_receive()</B
- > returns <TT
- CLASS="constant"
- ><B
- >TRUE</B
- ></TT
- > on success or <TT
- CLASS="constant"
- ><B
- >FALSE</B
- ></TT
- > on
- failure. If the function fails, the optional
- <VAR
- CLASS="parameter"
- >errorcode</VAR
- > will be set to the value of the system
- errno variable.
- </P
- ><P
- > See also <A
- HREF="function.msg-remove-queue.html"
- ><B
- CLASS="function"
- >msg_remove_queue()</B
- ></A
- >,
- <A
- HREF="function.msg-send.html"
- ><B
- CLASS="function"
- >msg_send()</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
- ></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-get-queue.html"
- ACCESSKEY="P"
- >Пред.</A
- ></TD
- ><TD
- WIDTH="34%"
- ALIGN="center"
- VALIGN="top"
- ><A
- HREF="index.html"
- ACCESSKEY="H"
- >Начало</A
- ></TD
- ><TD
- WIDTH="33%"
- ALIGN="right"
- VALIGN="top"
- ><A
- HREF="function.msg-remove-queue.html"
- ACCESSKEY="N"
- >След.</A
- ></TD
- ></TR
- ><TR
- ><TD
- WIDTH="33%"
- ALIGN="left"
- VALIGN="top"
- >msg_get_queue</TD
- ><TD
- WIDTH="34%"
- ALIGN="center"
- VALIGN="top"
- ><A
- HREF="ref.sem.html"
- ACCESSKEY="U"
- >Уровень выше</A
- ></TD
- ><TD
- WIDTH="33%"
- ALIGN="right"
- VALIGN="top"
- >msg_remove_queue</TD
- ></TR
- ></TABLE
- ></DIV
- ></div></center></div></td>
- <td><div style="display:none; width:200px;" id="o3" name="o3"><script charset="windows-1251" type="text/javascript" src="http://www.ozon.ru/PartnerTwinerNew.aspx?revident=bea9126b-c8e1-4bf5-b6d8-9a057f8feac6" ></script></div><script>o = document.getElementById('o3'); if(o) { var s = o.innerHTML; s = s.replace(/F6F6F6/gi,"FFFFFF"); o.innerHTML = s.replace(/padding-top: 10px; padding-bottom: 10px;/,"display:none;"); o.style.display = 'block'; } </script><br><div style="margin: 10px;"><script type="text/javascript"><!--
- google_ad_client = "pub-4093271809023514";
- /* 120x600, создано 01.11.2008 */
- google_ad_slot = "0438855731";
- google_ad_width = 120;
- google_ad_height = 600;
- //-->
- </script>
- <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script></div></td>
- </tr>
- </table>
- </td>
- </tr>
- <tr valign='bottom' height='1%'>
- <td> <table width=100% cellspacing=0 cellpadding=5 border=0 bgcolor=#9999CC>
- <tr valign=center>
- <td class='phpcopyright' width='45%' align='left'> Engine <a href="http://www.mnogosearch.org/">MnoGoSearch</a></td>
- <td class='phpcopyright' width='10%' align='center'>2007-2010 © <a href="mailto:webmaster@php.ru">PHP.RU</a></td>
- <td class='phpcopyright' width='45%' align='right' >Powered by <a target="_blank" href="http://odware.ru">ODware</a> <a HREF="http://440hz.ru">440Hz</a> </td>
- </tr>
- </table>
- <div style="text-align: right; padding: 5px">
- <!--LiveInternet counter-->
- <script type="text/javascript">document.write('<a href="http://www.liveinternet.ru/click" target=_blank><img src="http://counter.yadro.ru/hit?t53.6;r' + escape(document.referrer) + ((typeof(screen)=='undefined')?'':';s'+screen.width+'*'+screen.height+'*'+(screen.colorDepth?screen.colorDepth:screen.pixelDepth)) + ';u' + escape(document.URL) +';i' + escape('Жж'+document.title.substring(0,80)) + ';' + Math.random() + '" border=0 width=88 height=31 alt="" title="LiveInternet: показано число просмотров и посетителей за 24 часа"><\/a>');
- </script>
- <!--/LiveInternet-->
- <!-- SpyLOG -->
- <script src="http://tools.spylog.ru/counter2.2.js" type="text/javascript" id="spylog_code" counter="830950" ></script>
- <noscript><a href="http://u8309.50.spylog.com/cnt?cid=830950&f=3&p=0" target="_blank"><img src="http://u8309.50.spylog.com/cnt?cid=830950&p=0&f=4" alt='SpyLOG' border='0' width=88 height=31 ></a>
- </noscript>
- <!--/ SpyLOG -->
- </div>
- </td>
- </tr>
- </table>
- <script>
- <!--
- document.SEARCH.QS.focus();
- // --></script>
- <!--
- как же вы все это читаете?
- 440hz
- -->
- </body>
- </html>