On Fri, Oct 17, 2003 at 12:14:05PM -0600, William McLendon wrote: > I'm pretty new with this... What the differences in these are? Critical > issues, etc? The differences are that the base HTTPServer can only process one request at a time while the forking and threading servers can process more than one at a time. The ForkingTCPServer creates a new child process to handle each request, while the ThreadingTCPServer uses a new thread per request. You may want to read the SocketServer.py module for the details. Another technique for doing this in one process or thread is the event driven module used by Twisted and Medusa for example. > Is Python's fork()ing incomplete? I'm not sure what you mean by that. > Any workarounds? Modify the HTTPServer class from BaseHTTPServer.py to inherit from Create your own server class like this (stolen from BaseHTTPServer.py: class ForkingHTTPServer(SocketServer.ForkingTCPServer): allow_reuse_address = 1 # Seems to make sense in testing environment def server_bind(self): """Override server_bind to store the server name.""" SocketServer.TCPServer.server_bind(self) host, port = self.socket.getsockname() self.server_name = socket.getfqdn(host) self.server_port = port And even this will probably work: class ForkingHTTPServer(BaseHTTPServer.HTTPServer, SocketServer.ForkingMixIn): pass Then just define your server like this: server = ForkingHTTPServer(('127.0.0.1', 2000), httpRequestHandler) None of this is specific to python on the Mac, but I'm not sure how well OS 9 handles either fork or threads. There's no problem on OS X.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4