Thread Windows 7 Konsole nicht einfach beenden
(18 answers)
Opened by Mike at 2011-08-03 09:32
ja hier mal der code:
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 #!C:\Perl\bin\perl ##=============== Fehlermeldungen/DEBUG ===============## use warnings; use strict; use diagnostics; ##=============== END ===============## ##=============== INI-Benötigte Befehle ===============## use Config::IniFiles; my $config = Config::IniFiles->new( -file => "tsreader.ini" ); my $port = $config->val("port", "tsport"); my $ip = $config->val("ip", "tsip"); ##=============== END ===============## ##=============== Variablen Declarieren ===============## my $t = ''; my $function = "Funktion:"; my $doit = ''; my $dont_send = ''; my $chart = ''; my $program_number = ''; my $multicast_address = ''; my $multicast_port = ''; my @line = ''; ##=============== END ===============## ##=============== Verbindung/Controll TSreader ===============## use Telnet (); ##=============== Connect to TSReader ===============## $t = new Net::Telnet (Timeout => 1, Port => $port); eval{$t->open($ip);}; ##=============== Display TSReader sent us===============## @line = $t->getline(); print "TSReader connected.\nResponse: @line\n"; ##=============== Display functions ===============## print "Functions supported are:\n"; print " 1 - print programs in mux\n"; print " 2 - display graph\n"; print " 3 - switch to a multicast UDP mux\n"; print " 4 - play channel via VLC\n"; print " 5 - export to HTML\n"; print " 6 - show info\n"; print "Function? "; $function = <STDIN>; chop $function; if ($function eq 1) { #Get and print a list of programs $t->print("PROGRAM"); print "These programs are defined:\n"; $doit = 1; while($doit eq 1) { eval {@line = $t->getline(Timeout => 1);}; if ($@) {$doit=0;} else {print @line;} } } elsif ($function eq 2) { #Draw a graph $dont_send = 0; print "Available graphs are:\n"; print " 0 - close any existing graph\n"; print " 1 - Active PIDs by rate\n"; print " 2 - Active PIDs by PID\n"; print " 3 - PID usage 2D pie\n"; print " 4 - PID usage 3D pie\n"; print " 5 - Mux usage stacked area\n"; print " 6 - Mux usage line\n"; print " 7 - Video rate area\n"; print " 8 - Video rate line\n"; print " 9 - Program usage\n"; print " 10 - Video composition\n"; print "Which chart? "; $chart = <STDIN>; chop $chart; if ($chart eq 10) { print "Program number? "; $program_number = <STDIN>; chop $program_number; $t->print("PROGRAM $program_number"); @line = $t->getline(Timeout => 1); if (@line ="~ /502/") { print("?Invalid program number!\n"); $dont_send = 1; } } if ($dont_send eq 0) { $t->print("GRAPH $chart"); @line = $t->getline(Timeout => 1); } } elsif ($function eq 3) { #Switch to the multicast source and restart TSReader print "Multicast address to listen to? "; $multicast_address = <STDIN>; chop $multicast_address; print "UDP port to listen to? "; $multicast_port = <STDIN>; chop $multicast_port; $t->print("SOURCE TSReader_UDPMulticast.dll"); @line = $t->getline(Timeout => 1); print "Response to SOURCE: @line"; $t->print("TUNE $multicast_address $multicast_port"); @line = $t->getline(Timeout => 1); print "Response to TUNE: line"; } elsif ($function eq 4) { $dont_send = 0; print "Program number? "; $program_number = <STDIN>; chop $program_number; $t->print("PROGRAM $program_number"); @line = $t->getline(Timeout => 1); if (@line ="~ /502/") { print("?Invalid program number!\n"); $dont_send = 1; } if ($dont_send eq 0) { $t->print("PLAY VLC1"); @line = $t->getline(Timeout => 1); print "Response to PLAY: @line"; } elsif ($function eq 5) { $dont_send = 0; $t->print("EXPORT"); } elsif ($function eq 6) { $dont_send = 0; $t->print("INFO"); @line = $t->getline(Timeout => 1); print "INFO"; } } #all done $t->print("quit"); sag ich ihm dann auch durch "STDIN" er soll nicht beenden oder nur das auf eine eingabe gewartet wird? ja ich rufe das script von haus aus über die Dosbox und dem befehl "perl ***" auf, hab auch per "active state perlapp" ne exe erstellt passiert des geliche... hab eig auch alle Fehler ausgebessert modedit Editiert von GwenDragon: kaputte code-Tags repariert Last edited: 2011-08-03 12:39:08 +0200 (CEST) |