Re: Sending messages from php to C++ application via UDP socket

From: Date: Thu, 19 May 2011 09:14:10 +0000
Subject: Re: Sending messages from php to C++ application via UDP socket
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-312905@lists.php.net to get a copy of this message
On 18 May 2011 18:03, shiplu <shiplu.net@gmail.com> wrote: > Try to think a string is an array of bytes. > Parse that array of bytes at C++ end. > There should host to network and network to host data conversion function. > Use them. > > -- > Shiplu Mokadd.im > Just to confirm Sniplu's comment really. For example (see http://unicode.org/faq/utf_bom.html#bom4) $s_Utf8Bom = chr(0xEF) . chr(0xBB) . chr(0xBF); This will build the UTF-8 Byte Order Mark. You can use http://uk.php.net/manual/en/function.pack.php to build a binary string comprised of different values based upon C types (int/long, signed/unsigned, chars, hex strings, floats/doubles, nulls, etc.) In essence, if you have a C struct that represents the data you need to send, then you should be able to compose a suitable string. If you already have an app that can talk to the media player, then use a tool like wireshark to monitor the communication. That, at least, will give you real world example of the data you need to send. Richard. -- Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

« previous php.general (#312905) next »