On Fri, Apr 19, 2002 at 07:40:35PM +1000, Conan Chai wrote:
> hi all,
> i'm writing a simple proxy server that listens on 2 ports, 1 for browser and another 
>for admin client. the admin client is for administrative tasks such as adding new 
>users and reseting downloaded bytes. i'm currently using the IO::Select module but 
>this mode is blocking I/O, so i intend to change to use fork(), here comes the 
>question, i'm not sure how to listen to 2 ports using fork(). pls quote examples if 
>possible. thanks

Huh?  But IO::Select is exactly what you want.  And of course it's
blocking, since you don't have anything to do while waiting for a
connection anyways.

What you do is this:

Add both ports to your select queue, then wait for a connection.

As soon as a connection arrives, accept it, fork yourself and loop back
to the select while the forked childprocess does the hard work.

-- 
                       If we fail, we will lose the war.

Michael Lamertz                        |      +49 221 445420 / +49 171 6900 310
Nordstr. 49                            |                       [EMAIL PROTECTED]
50733 Cologne                          |                 http://www.lamertz.net
Germany                                |               http://www.perl-ronin.de 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to