summaryrefslogtreecommitdiff
path: root/server
blob: 49a140a4c2cf21be934618287c60a26a8a0a4eb6 (plain)
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
#!./perl

$pat = 'S n C4 x8';
$inet = 2;
$echo = 7;
$smtp = 25;
$nntp = 119;

$this = pack($pat,$inet,2345, 0,0,0,0);
select(NS); $| = 1; select(stdout);

if (socket(S,2,1,6)) { print "socket ok\n"; } else { die $!; }
if (bind(S,$this)) { print "bind ok\n"; } else { die $!; }
if (listen(S,5)) { print "listen ok\n"; } else { die $!; }
for (;;) {
    print "Listening again\n";
    if ($addr = accept(NS,S)) { print "accept ok\n"; } else { die $!; }

    @ary = unpack($pat,$addr);
    $, = ' ';
    print @ary; print "\n";

    while (<NS>) {
	print;
	print NS;
    }
}