Leser: 1
|< 1 2 3 >| | 21 Einträge, 3 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/perl
use IO::Socket;
use threads;
use threads::shared;
my $socket = IO::Socket::INET->new (
PeerAddr => '127.0.0.1',
Type => SOCK_STREAM,
PeerPort => 2005,
Proto=>"tcp"
);
my $t = threads->create( \&start_socket, <$socket> );
sub start_socket {
# hier Socketverbindung bearbeiten....
}
print "Elternprozess arbeitez ungestört weiter\n";
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/perl
use IO::Socket;
use threads;
use threads::shared;
my $socket = IO::Socket::INET->new (
PeerAddr => '127.0.0.1',
Type => SOCK_STREAM,
PeerPort => 2005,
Proto=>"tcp"
);
my $t = threads->create( \&start_socket);
sub start_socket {
while (<$socket>) {
print "$_\n"; # Antwort vom Server ausgeben
}
}
print "Elternprozess arbeitez ungestört weiter\n";
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
#!/usr/bin/perl
use IO::Socket;
use threads;
use threads::shared;
my $socket = IO::Socket::INET->new (
PeerAddr => '127.0.0.1',
Type => SOCK_STREAM,
PeerPort => 2005,
Proto=>"tcp"
);
my $t = threads->create( \&start_socket);
sub start_socket {
while (<$socket>) {
print "new Request\n";
}
}
sleep(1); # Warten bis Kind geboren ist
print $socket "An das Kind\n"; # Vater schreibt an die Socket
sleep(10);
close($socket);
|< 1 2 3 >| | 21 Einträge, 3 Seiten |