Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8036347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:35:23+00:00 2026-06-05T02:35:23+00:00

I have some scripts which must be fast as possible (used as mpd5 up/down

  • 0

I have some scripts which must be fast as possible (used as mpd5 up/down scripts).

Have the idea: lets this script send arguments to some tcp server and finish work, and then the server works hard and long.

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
     $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.
Also I cant locate any close or disconect method in docs of this Net::Server.

Can anyone point me to right direction?

UPD:

close($self->{server}->{client});

doesnt work too.

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”.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T02:35:25+00:00Added an answer on June 5, 2026 at 2:35 am

    After i posted this Q on rt.cpan.org , i get a answer:

    right code with fast disconnect is:

    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);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this script which simply kills an app KEY_NAME=/some/path kill `ps -ef |
I have this content script that downloads some binary data using XHR, which is
I have a script which collects an image, link and some text content from
Here I have a simple php script which displays some values from a database
In my Python script which uses Curses, I have a subwin to which some
I am writing a script which must copy some names into a multidimensional array,
I have some ideas how to tackle this, but it must be a relatively
I have some scripts that are supposed to be executable. But after it is
I have some long running scripts with breaks requiring input/interaction to continue but when
I have some command-line ruby scripts for things like pre-processing text files before uploading

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.