Subject: | Answer: How to close client connection without waiting when process_request finished. |
This is my test server script with Net::Server :
use Net::Server::PreForkSimple;
use base "Net::Server::PreForkSimple";
sub process_request {
my $self=shift;
my $a=<STDIN>;
close STDIN; close STDOUT; #trying to disconect client here
close($self->{server}->{client});
$self->{server}->{client}->close();
$self->log(1,"start $a");
sleep 50;
$self->log(1,"finish $a");
}
__PACKAGE__->run(port => 2000);
Problem is : i dont know how to disconect client on line after $a=.
Client script waiting all this "sleep 50". I am trying close STD* but
its doesnt help.
I test this by
echo test | nc 127.0.0.1 2000
and this command is working 50 sec.
But i want nc closed immediately after send "test".
Also I cant locate any close or disconect method in docs of this
Net::Server.
Can anyone point me to right direction?