HI,

I have a pair of C/S socket scripts running for a long time,without any
problem.There is just one server,and more than 120 clients,which all run
on linux box.
This day,beacuse of our network blocking,which mean many lost
packages,my server script became incorrect.It fork more than 1000 child
processes which can't exit.I think the reason is that the server can't
receive the EOF signal,which sent by client via shutdown(1) call,because
of the network blocking. But how can I resolve this problem?

this is client's socket code:

my $sock=IO::Socket::INET->new(PeerAddr => SERVER,
                                           PeerPort => PORT,
                                           Proto    => 'tcp');
                print $sock $var,CRLF;
                $sock->shutdown(1);


and this is server's socket code:

my $listen_socket = IO::Socket::INET->new( 
                                           LocalAddr => IPADDR,
                                           LocalPort => PORT,
                                           Listen    => 150,
                                           Proto     => 'tcp',
                                           Reuse     => 1,
                                           Timeout   => 3600,
                                         );
die "can't create socket: $@" unless defined $listen_socket;

while(1)
{
    next unless my $connection = $listen_socket->accept;
    die "can't fork:$!" unless defined (my $child = fork());

    if ($child==0)
    {
        $listen_socket->close;
        &writelog($connection);
        exit 0;
    }
    
    $connection->close;
}


thanks.
-- 
  Jeff Pan
  [EMAIL PROTECTED]

-- 
http://www.fastmail.fm - A fast, anti-spam email service.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to