'handler, if present, must reference a function or method that
takes one argument: a Request object. If handler is not
specified at creation time, Server *must* be subclassed.
(The handler method below is abstract.)
maxwrite is the maximum number of bytes (per Record) to write
to the server. I\'ve noticed mod_fastcgi has a relatively small
receive buffer (8K or so).
bindAddress, if present, must either be a string or a 2-tuple. If
present, run() will open its own listening socket. You would use
this if you wanted to run your application as an \'external\' FastCGI
app. (i.e. the webserver would no longer be responsible for starting
your app) If a string, it will be interpreted as a filename and a UNIX
socket will be opened. If a tuple, the first element, a string,
is the interface name/IP to bind to, and the second element (an int)
is the port number.
Set multiplexed to True if you want to handle multiple requests
per connection. Some FastCGI backends (namely mod_fastcgi) don\'t
multiplex requests at all, so by default this is off (which saves
on thread creation/locking overhead). If threads aren\'t available,
this keyword is ignored; it\'s not possible to multiplex requests
at all.'

def __init__(self, handler=None, maxwrite=8192, bindAddress=None, multiplexed=False):

    if (handler is not None):
        self.handler = handler
    self.maxwrite = maxwrite
    if thread_available:
        try:
            import resource
            maxConns = resource.getrlimit(resource.RLIMIT_NOFILE)[0]
        except ImportError:
            maxConns = 100
        maxReqs = maxConns
        if multiplexed:
            self._connectionClass = MultiplexedConnection
            maxReqs *= 5
        else:
            self._connectionClass = Connection
        self.capability = {FCGI_MAX_CONNS: maxConns, FCGI_MAX_REQS: maxReqs, FCGI_MPXS_CONNS: ((multiplexed and 1) or 0)}
    else:
        self._connectionClass = Connection
        self.capability = {FCGI_MAX_CONNS: 1, FCGI_MAX_REQS: 1, FCGI_MPXS_CONNS: 0}
    self._bindAddress = bindAddress
