Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] multiple POP-3 servers on one machine

On Tue, 31 Oct 2000, Umar Goldeli wrote:

> > Unless you are doing IP address based virtual hosting, which is what I am
> > using.
> In which case I can't tell you *exactly* what apache does - but I can give
> you a feasible method.. :)
> Basically in terms of a threaded application, you can always get one
> process to bind to port 80 and listen. Everytime a request comes in to
> that particular port (since there is only one port, regardless of the IP
> it will go to that port anyhow) the process can look at the connection
> struct which will include (amongst other things) source port, dest port,
> source ip, dest ip for that that particular stream.. it would then be a
> trivial task for the process to serve the appropriate site based on the
> dst ip.


For each Listen ip:port as configured in httpd.conf,
the parent Apache process bind()s a socket to that ip and port
and hangs a listen() on it. As many as you have specified.

Whenever a request comes in on a <ip,port> it is farmed off to
a child task to process, and another bind()/listen() is done
to listen for the next incoming request on THAT IP AND PORT.

If you've done any pre-forking/multi-ip-port server code, the above 
methodology will be familiar. For those who want to learn more,
there are some excellenet chapters on this very topic in
"The Perl Cookbook", towards the end of the book.

So all I really want is a preforking multi-IP highly configurable
POP-3 server that functions basically the same way that Apache

Rick Welykochy || Praxis Services