Re: Message queues not working properly PHP -> C [message #179590 is a reply to message #179588] |
Sun, 11 November 2012 19:01 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 11/11/2012 9:57 AM, Muffinman wrote:
> On 09-11-12 22:05, Muffinman wrote:
>> 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.
>
> Actually when I set 'serialize' to 'true' it doesn't include the
> previous message send. However, in c the messages comes with an addition
> at the beginning and end of the string which is why I turned it off in
> the first place ("s:2:" and ";"):
>
> spock: "s:2:"Hi";"
>
> This is preferable than some 'random' data, but ugly nonetheless.
>
> Maarten
>
Yes, that would be correct. When you enable serialize, PHP processes
the data through the serialize() function before sending it.
Now I've never tried sending between PHP and C, so I haven't seen your
problem. However, some questions:
1). What OS are you using (including version)?
2). Do you have all errors being displayed? Your php.ini file in your
test system should have:
error_reporting=E_ALL
display_errors=on
3). What does the code in you C program look like?
4). What compiler did you use for the C program?
I'm sure I can come up with more :) but this is a start.
Actually - I just thought of something else. PHP may not be adding the
ending null character. What happens if you send "Hi\0"?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|