[mythtv] Querying a MythBackend...
Bruce Markey
bjm at lvcm.com
Thu Mar 13 17:16:51 EST 2003
Dan Man wrote:
> My only public web server that can access my MythTV machines is a
> Windows box. I'm working on creating an object that can query the Myth
> boxen in a fashion similar to MythWeb. (I can not install PHP on this
> server). I've written the code to do TCP communications, for instance I
> can connect to a web server and retrieve a web page. Now I'm trying to
> understand the syntax of communicating with a Myth box. Looking at
> MythWeb I'm looking up the MasterServerIP and MasterServerPort and
> connecting to it successfully, but my queries never return.
>
> My questions are:
>
> I see that queries need to be formatted as QueryLength + 8 spaces +
> query. Is that correct?
Almost. It's an 8 byte field with an ASCII int string for
the content length of the message that follows the 8 bytes.
So a 16 byte message would have "1", "6", six spaces then 16
bytes and no terminator for a total of 24 bytes.
> Does anything need to be sent to the back end before queries can happen?
Connect and send an "ANN ..." to announce your arrival.
> Am I correct in using < MasterServerIP and MasterServerPort?
Yes.
> Any pointers here?
1) I agree with Pete, don't reinvent the wheel ;-).
2) Uncomment cerr << payload in MC/libs/libmyth/util.cpp to
see the control socket messages printed to your terminal.
-- bjm
More information about the mythtv-dev
mailing list