root/lang/perl/Server-Starter/trunk/t/01-starter-echod.pl @ 35269

Revision 35261, 0.5 kB (checked in by kazuho, 5 years ago)

no more use of SIGUSR2

  • Property svn:executable set to *
Line 
1#! /usr/bin/perl
2
3use strict;
4use warnings;
5
6use lib qw(blib/lib lib);
7
8use IO::Socket::INET;
9use Server::Starter qw(server_ports);
10
11$SIG{TERM} = sub {
12    exit 0;
13};
14
15my $listener = IO::Socket::INET->new(
16    Proto => 'tcp',
17);
18$listener->fdopen((values %{server_ports()})[0], 'w')
19    or die "failed to bind listening socket:$!";
20
21while (1) {
22    if (my $conn = $listener->accept) {
23        my $buf;
24        while ($conn->sysread($buf, 1048576) > 0) {
25            $conn->syswrite("$$:$buf");
26        }
27    }
28}
Note: See TracBrowser for help on using the browser.