Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Activeperl 5.6 fork() doesn't friggin work

by Corion (Patriarch)
on Apr 18, 2002 at 07:04 UTC ( [id://160126]=note: print w/replies, xml ) Need Help??


in reply to Activeperl 5.6 fork() doesn't friggin work

I'd say that fork() does work sometimes under ActiveState Perl, but the problems start as soon as you share too much stuff (like, for example, sockets) between the two processes.

There are some ways around your specific problem, for example, you could use a perlfunc:select-based client that checks whether there is something to read or write. I've done so with a server here, but the concept can be reused for a client as well.

As for another route, if you have control over the server as well, you might want to change your protocol to HTTP or some other protocol that sends the size of the response within the response header.

perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2025-04-30 00:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.