summaryrefslogtreecommitdiff
path: root/udpd.pl
diff options
context:
space:
mode:
authorAndreas Mair <amair.sob@googlemail.com>2005-03-06 08:11:12 +0100
committerAndreas Mair <amair.sob@googlemail.com>2005-03-06 08:11:12 +0100
commit7525bed2d315a25ac2caf95ff0bf44c905d58a7e (patch)
tree64f68331dd109cf5c92182d10bb53c614db4a73b /udpd.pl
downloadvdradmin-am-0.97-am1.tar.gz
vdradmin-am-0.97-am1.tar.bz2
2005-03-06: 0.97-am1 "initial release"v0.97-am1
This is mainly the lastest vdradmin (v0.97) with different patches applied: - vdradmin-0.97 has been taken from linvdr-0.7. - xpix's BigPatch_0.9pre5 (ported from vdradmin-0.95 to vdradmin-0.97 (see HISTORY.bigpatch). - included changes from vdradmin-0.95-ct-10 (see HISTORY.ct). - included vdradmin-0.95_0.9_pre5_fb1.diff (see HISTORY.macfly). - included vdradmin-0.96-rename.diff which also needs an applied "vdr-aio21_svdrprename.patch" patch (don't know the author right now). My own changes: - included missing "Was läuft heute?" template (found at www.vdr-portal.de). - fixed some rendering problems with "New Timer" and "New Autotimer" on KDE's Konqueror. - Beautified recordings listing (at least in my eyes ;-) - Added "Size" selectbox to TV template.
Diffstat (limited to 'udpd.pl')
-rwxr-xr-xudpd.pl52
1 files changed, 52 insertions, 0 deletions
diff --git a/udpd.pl b/udpd.pl
new file mode 100755
index 0000000..c4a38f1
--- /dev/null
+++ b/udpd.pl
@@ -0,0 +1,52 @@
+#!/usr/bin/perl
+
+##
+# Simple UDP Server/Client to display messages in VDR
+#
+# 22.02.2004 by Thomas Koch <tom at linvdr dot org>
+##
+
+use IO::Socket;
+use IO::Socket::INET 1.26;
+use strict;
+
+my $myself = join("", $0 =~ /^.*\/(.*)/);
+
+# Server
+if($myself eq "udpd.pl") {
+ my $pid = fork();
+ if($pid != 0) {
+ exit(0);
+ }
+ my($Socket) = IO::Socket::INET->new(
+ Proto => 'udp',
+ LocalPort => 4711,
+ Reuse => 1
+ ) || die;
+ my $message;
+ while($Socket->recv($message, 1024)) {
+ my($port, $ipaddr) = sockaddr_in($Socket->peername);
+ my $hishost = gethostbyaddr($ipaddr, AF_INET);
+ system("logger udpd: client $hishost with message \\'$message\\'");
+ for(my $z = 0; $z < 3; $z++) {
+ for(my $i = 0; $i < 3; $i++) {
+ system("svdrpsend.pl mesg $message 2>/dev/null >/dev/null");
+ }
+ sleep(3);
+ }
+ }
+ exit(0);
+}
+
+# Client
+if($myself eq "udpc.pl") {
+ my $message = join(" ", @ARGV);
+ my $Socket = IO::Socket::INET->new(
+ PeerAddr => inet_ntoa(INADDR_BROADCAST),
+ PeerPort => 4711,
+ Proto => 'udp',
+ Broadcast => 1
+ ) || die;
+ my $result = $Socket->send($message);
+}
+