note 80635 modified in function.msg-receive by vrana

From: Date: Thu, 07 Jul 2011 16:12:35 +0000
Subject: note 80635 modified in function.msg-receive by vrana
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-181336@lists.php.net to get a copy of this message
Consider this e.g. Linux situation: <?php //file send.php $ip = msg_get_queue(12340); msg_send($ip,8,"abcd",false,false,$err); //----------------------------------------------------- <?php //file receive.php $ip = msg_get_queue(12340); msg_receive($ip,0,$msgtype,4,$data,false,null,$err); echo "msgtype {$msgtype} data {$data}\n"; msg_receive($ip,0,$msgtype,4,$data,false,null,$err); echo "msgtype {$msgtype} data {$data}\n"; ?> Now run: in terminal #1 php5 receive.php in terminal #2 php5 receive.php in terminal #3 php5 send.php Showing messages from queue will flip-flop. It means you run once send.php, the message will be shown in terminal #1. Second run it will be in t#2, third #1 and so on. --was-- Consider this e.g. Linux situation: <?php //file send.php $ip = msg_get_queue(12340); msg_send($ip,8,"abcd",false,false,$err); //----------------------------------------------------- <?php //file receive.php $ip = msg_get_queue(12340); msg_receive($ip,0,$msgtype,4,$data,false,null,$err); echo "msgtype {$msgtype} data {$data}\n"; msg_receive($ip,0,$msgtype,4,$data,false,null,$err); echo "msgtype {$msgtype} data {$data}\n"; Now run: in terminal #1 php5 receive.php in terminal #2 php5 receive.php in terminal #3 php5 send.php Showing messages from queue will flip-flop. It means you run once send.php, the message will be shown in terminal #1. Second run it will be in t#2, third #1 and so on. http://php.net/manual/en/function.msg-receive.php

« previous php.notes (#181336) next »