Skip Menu |

This queue is for tickets about the Net-Server CPAN distribution.

Report information
The Basics
Id: 76995
Status: resolved
Priority: 0/
Queue: Net-Server

People
Owner: Nobody in particular
Requestors: korjavin [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: 0.99
Fixed in: (no value)



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?
I just tried with the just released 2.000 and the problem appears to work with your code. As a safer level of abstraction - you might try the following code that handles the closing of tied handles and sockets for you. use base "Net::Server::PreForkSimple"; sub process_request { my $self = shift; my $a = <STDIN>; $self->post_process_request; $self->log(1,"start $a"); sleep 50; $self->log(1,"finish $a"); } __PACKAGE__->run(port => 2000);