[mythtv-users] Sending Myth Socket commands using Perl - lack of response
Stefan Janowski
stefanj at dsl.pipex.com
Sat Oct 25 16:57:07 UTC 2008
Hi all
I'm having a stab at using a Perl script to create a socket to the Myth
backend and send commands. After much messing around I have the
following test code which does work. However, if I send the command
MYTH_PROTO_VERSION 31 with the wrong version I get a response which is
good, if I send the correct version number I should expect a response of
'13 ACCEPT[]:[]31 ' but I get nothing.
Strange thing is when first tried it, it was working - I was getting
responses to both correct and incorrect proto versions. If I send an ANN
request the myth log reports adding the client, but again but response
from the code.
Any help here much appreciated/
Cheers
Stefan
#!/usr/bin/perl -w
use strict;
use IO::Socket;
print "Setting up connection\n";
my $sock = new IO::Socket::INET (
PeerAddr => '192.168.2.100',
PeerPort => '6543',
Proto => 'tcp', );
die "Could not create socket : $!\n" unless $sock;
my $command = "MYTH_PROTO_VERSION 31";
$command = length($command)." ".$command;
if ($sock -> send ($command)) {
print "message sent : $command\n";
} else {
print "message failed";
}
while (<$sock>) {print};
#$sock->close();
close ($sock);
print "Ended connection\n";
More information about the mythtv-users
mailing list