3 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
while(!$quit) {
sub_routine();
next unless my $session = $socket->accept;
my $peer = gethostbyaddr($session->peeraddr,AF_INET) || $session->peerhost;
my $Port = $session->peerport;
while(<$session>) {
print $session $sub_eins . CRLF;
print $session $sub_zwei . CRLF;
}
close($session);
}
close $socket;
1
2
3
4
5
6
while(1) {
print $socket "hallo\n";
my $sub_eins = <$socket>;
my $sub_zwei = <$socket>;
my $output = "Erstens:\t$sub_eins\nZweitens:\t$sub_zwei";
}
1
2
3
4
5
6
7
8
9
10
11
12
13
while(!$quit) {
sub_routine();
next unless my $session = $socket->accept;
my $peer = gethostbyaddr($session->peeraddr,AF_INET) || $session->peerhost;
my $Port = $session->peerport;
print $session "Hallo client" . CRLF;
while(<$session>) {
print $session $sub_eins . CRLF;
print $session $sub_zwei . CRLF;
}
close($session);
}
close $socket;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/perl
use strict;
use warnings;
use IO::Socket qw(:DEFAULT :crlf);
my $host = "192.168.1.1";
my $port = "2050";
my $socket = IO::Socket::INET->new("$host:$port") || die
"Konnte Socket Objekt nicht erzeugen: $!";
while(<$socket>) {
print $socket "hallo" . CRLF;
my $eins = <$socket>;
my $zwei = <$socket>;
print "$eins\n$zwei\n";
}
$socket->close || warn "Fehler beim schließen des Sockets: $@";
3 Einträge, 1 Seite |