5 BEGIN { $ENV{PATH} = '/usr/ucb:/bin' }
6 sub logmsg { print "$0 $$: @_ at ", scalar localtime, "\n" }
9 my $uaddr = sockaddr_un($NAME);
11 socket(Server,AF_UNIX,SOCK_STREAM,0) || die "socket: $!";
13 bind (Server, $uaddr) || die "bind: $!";
14 listen(Server,SOMAXCONN) || die "listen: $!";
16 logmsg "server started on $NAME";
19 if ($rc > 0) { #parent
21 } elsif ($rc < 0) { # error
22 logmsg "fork failed: $rc";
26 accept(Client,Server);
27 logmsg "connection on $NAME";
28 print Client "from server\n";