Hi,

I'm developing a PHP program that must send data, over a socket connection, to a server. The server requires the data in a particular format, e.g.:

FORMAT:
3-byte delimiter - Message Length (N = 4 bytes) - Message Type (4 bytes) - Message Body (N - 4 bytes) - 3-byte Delimiter


SAMPLE MESSAGE:
STX00110018Hello WorldENX

The sparse documentation *seems* to indicate that the message data must be in binary format. The reason I say "seems" is that the docs say the data must be in a particular byte order (bigendian, I think, 'cause the server is running on SuperSPARC). It also talks about default integer size of 32 bits, unsigned char, blah, blah, blah—stuff I normally never worry about with PHP. All the sample code is in C, which I don't know. I'm a one-trick (PHP) pony.

Now, as I understand it, socket_write($socket, $data) by default will send $data in ASCII format—right? But if I must send this message in binary, then would I use pack() to convert the ASCII to binary?

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



Reply via email to