Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: HTTP::Daemon Script.

by physi (Friar)
on Jul 06, 2001 at 13:02 UTC ( [id://94413]=note: print w/replies, xml ) Need Help??


in reply to HTTP::Daemon Script.

Don'tr know anything about the HTTP::Daemon module, but you have to use fork to get a new process for the communication with the client. Then the main process can accept mor connetions at the same time. Try:
use HTTP::Daemon; my $d = HTTP::Daemon->new(LocalPort => 8080); while (my $c = $d->accept) { my $pid= fork; if (! $pid) { ###It's the child process here while (my $r = $c->get_request) { print $r->method ."\n" . $r->url->path ."\n"; } $c->close; undef($c); } ### And that's the end of the while loop from the father process }
If you cannot fork on your system (i.e. Perl4Win 5.003) you have to use select and/or Multiplex to do the job. But the easiest way might be to fork your processes.
----------------------------------- --the good, the bad and the physi-- -----------------------------------

Replies are listed 'Best First'.
Re^2: HTTP::Daemon Script.
by strredwolf (Chaplain) on Feb 22, 2007 at 17:25 UTC
    You don't have to close and undef $c while you're the parent, after the fork?

    --
    $Stalag99{"URL"}="http://stalag99.net";

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://94413]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-04-23 18:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found