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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 19, 2011 at 3:14 PM, Richard Quadling <rquadling@xxxxxxxxx>wrote:

> On 18 May 2011 18:03, shiplu <shiplu.net@xxxxxxxxx> 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.
>
>
If there is already a protocol defined for such communication, use it. To
get hint about this protocol use wireshark like tools.
If no protocol is defined yet. You need to define one.
For this all you have to make a serializer and an unserializer function for
both php and c++ end that obeys the protocol.
Now this serializer can use xml, yml, json, binary, base64  or any different
format..

-- 
Shiplu Mokadd.im
My talks, http://talk.cmyweb.net
Follow me, http://twitter.com/shiplu
Innovation distinguishes between follower and leader

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux