List Info

Thread: note 77446 added to function.pack




note 77446 added to function.pack
user name
2007-08-29 22:43:45
Hello everybody. Let us supose that some program in PHP
needs to communicate some other program using a filesystem
pipe. Supposing that the pipe is already present in the
filesystem, we need to send this program a message using a
very simple protocol, something like this

--------------------------------
| ID | Length | Message |
--------------------------------

where ID is a numeric identifier, Length is the length of
Message and Message contains a string. What is the best way
to accomplish this ?. On the other side (the program that is
running in background is a Python program that reads a
message when available and executes some code). I tried to
use the pack function but the Python program seems to get
wrong the message. The code for sending a message from PHP :


function send_message_to_pipe ($ID, $length, $msg_body) {

                $pipe = fopen ("../../fifo",
"wb");

                if ($length == 0)
                        $packed_msg = pack ("ii",
$ID, $length);
                else
                        $packed_msg = pack
("iic*", $ID, strlen ($msg_body), $message);

                fwrite ($pipe, $packed_msg);
                fclose ($pipe);
        }
----
Server IP: 201.216.232.3
Probable Submitter: 201.255.61.128
----
Manual Page -- http:/
/www.php.net/manual/en/function.pack.php
Edit        -- https://master
.php.net/note/edit/77446
Del: integrated  -- h
ttps://master.php.net/note/delete/77446/integrated
Del: useless     -- http
s://master.php.net/note/delete/77446/useless
Del: bad code    -- htt
ps://master.php.net/note/delete/77446/bad+code
Del: spam        -- https:/
/master.php.net/note/delete/77446/spam
Del: non-english -- 
https://master.php.net/note/delete/77446/non-english
Del: in docs     -- http
s://master.php.net/note/delete/77446/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/77446
Reject      -- https://mast
er.php.net/note/reject/77446
Search      -- https://
master.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


note 77446 rejected from function.pack by cece
user name
2007-08-31 06:58:25
Note Submitter: mindmaster at gmail dot com 

----

Hello everybody. Let us supose that some program in PHP
needs to communicate some other program using a filesystem
pipe. Supposing that the pipe is already present in the
filesystem, we need to send this program a message using a
very simple protocol, something like this

--------------------------------
| ID | Length | Message |
--------------------------------

where ID is a numeric identifier, Length is the length of
Message and Message contains a string. What is the best way
to accomplish this ?. On the other side (the program that is
running in background is a Python program that reads a
message when available and executes some code). I tried to
use the pack function but the Python program seems to get
wrong the message. The code for sending a message from PHP :


function send_message_to_pipe ($ID, $length, $msg_body) {

                $pipe = fopen ("../../fifo",
"wb");

                if ($length == 0)
                        $packed_msg = pack ("ii",
$ID, $length);
                else
                        $packed_msg = pack
("iic*", $ID, strlen ($msg_body), $message);

                fwrite ($pipe, $packed_msg);
                fclose ($pipe);
        }

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )