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
Message queues not working properly PHP -> C [message #179582] Fri, 09 November 2012 21:05 Go to previous message
Muffinman is currently offline  Muffinman
Messages: 3
Registered: November 2012
Karma:
Junior Member
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";
?>
*********************
[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 21 16:20:13 GMT 2024

Total time taken to generate the page: 0.06413 seconds