PageRenderTime 7ms CodeModel.GetById 3ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/IronPython_Main/Runtime/Tests/LinqDlrTests/testenv/perl/eg/core/client

#
Perl | 34 lines | 26 code | 7 blank | 1 comment | 11 complexity | a4639b828db44d716ac97384249537f3 MD5 | raw file
 1#!./perl
 2
 3$pat = 'S n C4 x8';
 4$inet = 2;
 5$echo = 7;
 6$smtp = 25;
 7$nntp = 119;
 8$test = 2345;
 9
10$SIG{'INT'} = 'dokill';
11
12$this = pack($pat,$inet,0,   128,149,13,43);
13$that = pack($pat,$inet,$test,127,0,0,1);
14
15if (socket(S,2,1,6)) { print "socket ok\n"; } else { die $!; }
16if (bind(S,$this)) { print "bind ok\n"; } else { die $!; }
17if (connect(S,$that)) { print "connect ok\n"; } else { die $!; }
18
19select(S); $| = 1; select(stdout);
20
21if ($child = fork) {
22    while (<STDIN>) {
23	print S;
24    }
25    sleep 3;
26    do dokill();
27}
28else {
29    while (<S>) {
30	print;
31    }
32}
33
34sub dokill { kill 9,$child if $child; }