This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl 3.0 patch #17 patch #16, continued
[perl5.git] / server
1 #!./perl
2
3 $pat = 'S n C4 x8';
4 $inet = 2;
5 $echo = 7;
6 $smtp = 25;
7 $nntp = 119;
8
9 $this = pack($pat,$inet,2345, 0,0,0,0);
10 select(NS); $| = 1; select(stdout);
11
12 if (socket(S,2,1,6)) { print "socket ok\n"; } else { die $!; }
13 if (bind(S,$this)) { print "bind ok\n"; } else { die $!; }
14 if (listen(S,5)) { print "listen ok\n"; } else { die $!; }
15 for (;;) {
16     print "Listening again\n";
17     if ($addr = accept(NS,S)) { print "accept ok\n"; } else { die $!; }
18
19     @ary = unpack($pat,$addr);
20     $, = ' ';
21     print @ary; print "\n";
22
23     while (<NS>) {
24         print;
25         print NS;
26     }
27 }