Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #7514

Re: Message queues not working properly PHP -> C

From "M. Strobel" <sorry_no_mail_here@nowhere.dee>
Newsgroups comp.lang.php
Subject Re: Message queues not working properly PHP -> C
Date 2012-11-10 17:57 +0100
Message-ID <ag7fb4FdrhqU1@mid.uni-berlin.de> (permalink)
References <509d702d$0$773$58c7af7e@news.kabelfoon.nl>

Show all headers | View raw


Am 09.11.2012 22:05, schrieb Muffinman:
> Hello all,
> 
> I've got a php script that needs to send out some info to a c script
> (already running). Somehow when php sends out through a message queue it
> looks like it copies the previous message (send by php or c) and copies
> it's own message over it with the previous message still visible if it
> is longer than the next php message. No messages are lost though, only
> copied and overwritten.
> 
> So see below the terminal output. First we send three time "Hi" (the
> quotes are added by the c app). Then three time "Hai hai" and the last
> time "Hi".
> 
> Adding \r, \n or \n\r does not help
> 
> Can someone tell me what's going wrong here? Communication between php
> -> php goes without error, same goes for c -> c and c -> php. But php ->
> c not.
> 
> The php script is copied below.
> 
> Thanks in advance, Maarten
> 
> key is 1107375495
> spock: ready to receive messages, captain. msqid = 196612
> spock: "Hi"
> spock: "Hi"
> spock: "Hi"
> spock: "Hai hai"
> spock: "Hai hai"
> spock: "Hai hai"
> spock: "Hii hai"
> 
> ************************
> <?php
> $MSGKEY = ftok ('/Users/Maarten/test.test' , 'B') ;
> 
> 
>      $msg_id = msg_get_queue ($MSGKEY, 0666);
> print_r ($msg_id);
> 
>      if (!msg_send ($msg_id, 1, "Quit", false, true, $msg_err))
>         echo "Msg not sent because\n";
> ?>
> *********************
> 

Do a 'cat /proc/sys/fs/mqueue/msg_max', it shows 10 on my system. Maybe your queue is
full. See the manual on msg_get_queue().

/Str.

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Message queues not working properly PHP -> C Muffinman <news**REMOVETHIS**@koster.tk> - 2012-11-09 22:05 +0100
  Re: Message queues not working properly PHP -> C "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-11-10 17:57 +0100
    Re: Message queues not working properly PHP -> C Muffinman <news**REMOVETHIS**@koster.tk> - 2012-11-11 15:41 +0100
  Re: Message queues not working properly PHP -> C Muffinman <news**REMOVETHIS**@koster.tk> - 2012-11-11 15:57 +0100
    Re: Message queues not working properly PHP -> C Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-11 14:01 -0500

csiph-web