Thread Socket.pm (socketpair): bidirektionale Kommunikation (13 answers)
Opened by bloonix at 2006-05-31 16:49

bloonix
 2006-05-31 16:49
#66838 #66838
User since
2005-12-17
1615 Artikel
HausmeisterIn
[Homepage]
user image
Hallo Leute,

das folgende Beispiel hängt

Code: (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
use strict;
use warnings;
use Socket;

$| = 1;

my ($kidfh, $dadfh);
socketpair($kidfh, $dadfh, AF_UNIX, SOCK_STREAM, PF_UNSPEC)
or die "socketpair: $!";

if (my $pid = fork) {
close $dadfh;
print $kidfh "Parent Pid $$ sendet dies\n";
# PARENT HAENGT HIER
chomp(my $line = <$kidfh>);
print "Parent Pid $$ liest gerade dies: $line\n";
close $kidfh;
waitpid($pid,0);
} else {
close $kidfh;
# CHILD HAENGT HIER
chomp(my $line = <$dadfh>);
print "Child Pid $$ liest gerade dies: $line\n";
print $dadfh "Child Pid $$ sendet dies\n";
close $dadfh;
exit;
}


und ich weiß echt nicht warum. Normalerweise sollte es funktionieren.

Viele Grüße,
opi
What is a good module? That's hard to say.
What is good code? That's also hard to say.
One man's Thing of Beauty is another's man's Evil Hack.

View full thread Socket.pm (socketpair): bidirektionale Kommunikation