AW: [mythtv] Help with mythprotocol

Jochen Kühner jochen.kuehner at gmx.de
Mon Nov 14 07:26:47 EST 2005


If have tested this with a little vb program today,

When I send:
21      MYTH_PROTO_VERSION 20
Everything works with my current svn version!!!

-----Ursprüngliche Nachricht-----
Von: mythtv-dev-bounces at mythtv.org [mailto:mythtv-dev-bounces at mythtv.org] Im
Auftrag von Neil
Gesendet: Donnerstag, 10. November 2005 09:08
An: Development of mythtv
Betreff: Re: [mythtv] Help with mythprotocol

On Wed, 2005-11-09 at 20:41 -0500, Isaac Richards wrote:
> On Wednesday 09 November 2005 08:15 pm, Neil wrote:
> > Having a rather frustrating time with the myth backend protocol at the
> > moment!
> >
> > Been looking at these docs:
> > http://www.mythtv.info/moin.cgi/MythProtocol_5f14
> >
> > Have coded a socket to the appropriate port on the backend server, and
> > send the first command:
> >
> > 22      MYTH_PROTO_VERSION 19
> >
> > to which the server responds:
> >
> > 13      REJECT[]:[]19
> >
> > I would expect to see an ACCEPT message returned (I am, after all,
> > specifying the version that it is expecting!) I realise that the length
> > of the command "MYTH_PROTO_VERSION 19" is actually only 21 bytes, but if
> > I send "21      MYTH_PROTO_VERSION 19", the server doesn't respond at
> > all.
> >
> > Any help massively appreciated!
> 
> Well, the length should be 21 - make sure you're not terminating that
string 
> with anything.  Be helpful to see your code, if that's not it.
> 
> Isaac

Thanks for the responses.

I'm using Java, and this is the code-snippet:

	String command1=new String("");
        String command=new String("");
        try {
            Socket sock=new Socket(new String("192.168.1.5"), 6543);
            DataInputStream dis=new
DataInputStream(sock.getInputStream());
            PrintStream ps=new PrintStream(sock.getOutputStream());
            command1="MYTH_PROTO_VERSION 19";
            command=command1.length()+1 + "      " + command1;
            System.out.println(command);
            ps.print(command);
            System.out.println(dis.readLine());
            sock.close();
        } catch (Exception x) {
            x.printStackTrace();
        }
        System.exit(0);

which results in

22      MYTH_PROTO_VERSION 19
13      REJECT[]:[]19

I'm fairly sure the problem lies with the line:

command=command1.length()+1 + "      " + command1;

originally this was just:

command=command1.length() + command1;

but this (and a dozen other variations!) resulted in absolutely no
response from the backend. The line, as it stands, is the only thing to
get any response at all!

What I want to be able to do (eventually) is call mythbackend to
reschedule the recordings, as I've written a java utility that searches
for tv programs based on keywords and allows the user to select shows
for recording. The code to insert the data into mythconverg.record is
all working, I just need to be able to do a reschedule.

As I understand it, I should do something like:

xx       MYTH_PROTO_VERSION 19
ACCEPTED
xx	 ANN Playback Myputer 0
ACCEPTED
xx	 RESCHEDULE_RECORDINGS -1

Thanks again

Neil




More information about the mythtv-dev mailing list