7 Einträge, 1 Seite |
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
#!/usr/bin/perl
use warnings;
use Tk;
open(PING, "ping 127.0.0.1 -t |")
or die "Fehler: $!\n";
my $mw = MainWindow->new();
my $t = $mw->Text(-width => 80, -height => 25, -wrap => 'none');
$t->pack(-expand => 1);
$mw->fileevent(\*PING, 'readable', [\&print_widget, $t]);
MainLoop;
sub print_widget {
my($widget) = @_;
$_ = <PING>;
print $_;
$widget->insert('end', $_);
$widget->yview('end');
}
1
2
3
4
5
6
ping 127.0.0.1 -t
ping: option requires an argument -- t
Usage: ping [-LRUbdfnqrvVaA] [-c count] [-i interval] [-w deadline]
[-p pattern] [-s packetsize] [-t ttl] [-I interface or address]
[-M mtu discovery hint] [-S sndbuf]
[ -T timestamp option ] [ -Q tos ] [hop1 ...] destination
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/perl
use warnings;
use Tk;
use IO::Socket;
my $input = IO::Socket::INET->new (
PeerAddr => '127.0.0.1',
Type => SOCK_STREAM,
PeerPort => 2006,
Proto=>"tcp"
) or die "kann Server nicht kontaktieren\n";
my $mw = MainWindow->new();
$mw->fileevent($input, 'readable', sub {
$mw->configure(-title => "Es funktioniert")
});
close($input);
MainLoop;
7 Einträge, 1 Seite |