Get the Best IPTV Service
#!/usr/bin/perl -w # Filename : client.pl use strict; use IO::Socket; my $recv_data; my $line2; my $datestring; my $ICAO; my $filename = '/home/fred/report.txt'; my $dbfile = '/home/fred/perladsb/adsb.db'; my $find; my $socket = new IO::Socket::INET ( PeerAddr => '127.0.0.1', PeerPort => 30002, Proto => 'tcp', ) or die "Couldn't connect to Server\n"; while (1) { $socket->recv($recv_data,17); #print $recv_data."\n"; if ($recv_data =~ /^\*..AE/ or $recv_data =~ /^\*..016/ or $recv_data =~ /^\*..777/ or $recv_data =~ /^\*..B/ or $recv_data =~ /^\*..ADFC/ or $recv_data =~ /^\*..ADFD/ or $recv_data =~ /^\*..ADFE/ or $recv_data =~ /^\*..ADFF/) { # print "Data ->$recv_data \n"; $line2 = substr($recv_data, 0, -8); $datestring = localtime(); $ICAO = substr($line2, 3); # Do Database Lookup Here $find = ""; open(FILE, $dbfile) or die "Can't read file 1\n"; my @lines = ; for (@lines) { if ($_ =~ /$ICAO/) { $find = $_; } } close FILE; if ($find eq "") { $find = "$ICAO\n"; } open(my $fh, '>>', $filename) or die "Could not open file '$filename' $!"; print $fh "$datestring $find"; close $fh; sleep 10; } } Flash Sale Popup