This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl 3.0 patch #27 patch #19, continued
[perl5.git] / server
CommitLineData
a687059c
LW
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);
10select(NS); $| = 1; select(stdout);
11
12if (socket(S,2,1,6)) { print "socket ok\n"; } else { die $!; }
13if (bind(S,$this)) { print "bind ok\n"; } else { die $!; }
14if (listen(S,5)) { print "listen ok\n"; } else { die $!; }
15for (;;) {
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}