As suggested, fork will do the trick. The thing you need to be
careful of is not swarming the machine with forks. Up to a point, it
will get the job done faster, but isn't very friendly to the other
programs.
Also, at some point you probably get diminishing returns until
you have so many forks that none of them get done in a reasonable amount of time.
So...keep a counter of how many forks you have launched and don't start new ones until some have been reaped.
(see waitpid...). On my own scanner and on various stress testing clients, I have provided the number of
forks to be defined at command line (or defaulted to 5 at a time). See nmap.
IO:Select is not what you want here. Not only is it not threading or forking, but is actually used to multiplex reading and
writing to/from handles that have already been established. Once you get the scanner done, write a multiplexing server for some
real fun and a good introduction to network server coding. :-)
Have a blast!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.