FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Message queues not working properly PHP -> C
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Message queues not working properly PHP -> C [message #179583 is a reply to message #179582] Sat, 10 November 2012 16:57 Go to previous messageGo to previous message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma:
Senior Member
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.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Using += assignment recursively on an array w/o notice
Next Topic: phpmyadmin export
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 11:38:57 GMT 2024

Total time taken to generate the page: 0.03825 seconds