Jeremy, Below is a working version, there were a couple of '()' missing from function calls and a couple of other things. I've also included a (rather scrappy) HTTP server using Python's HTTPServer library. If you can sort the code out, it provides a threaded HTTP server for you to use if that's any help ?
Weberver1 ---------------------------- from socket import * class webserver: def __init__(self,port,wwwroot): self.PORT = port self.WWWROOT = wwwroot def start(self): print "Starting server..." ss = socket(AF_INET,SOCK_STREAM) ss.bind(("127.0.0.1",self.PORT)) print "Server Bound" ss.setblocking(0) ss.listen(1) print "\nListening..." self.handle(ss) # Whenever calling a method from your # own class, make sure it's self.xxxxx def checkForConn(self, ss): # Don't forget those "self" parameters try: addr = ss.accept() # Make sure those '()' are in there except: return None print "connection from",addr return addr def handle(self, ss): # "self" parameters Done = 0 # Need to assign Done before referencing it while not Done: if self.checkForConn(ss): # Again, self.xxxx print "hit\n" Done = 1 if __name__ == "__main__": server = webserver(800,'/') # Make sure port is passed as integer server.start() # '()' again Threaded Webserver ------------------------------------------------- ########################################### # MJW Simple (Threaded) Python Web Server import SocketServer import BaseHTTPServer from BaseHTTPServer import BaseHTTPRequestHandler # So we can handle the HTTP request ######################################################################################## try: # First thing we'll do is determine import thread # whether we can thread, if not we'll fork mixin = SocketServer.ThreadingMixIn # and if we can't fork either, then there's # not much point in running our server so except ImportError: # we'll quit. if not hasattr(os, 'fork'): print "ERROR: your platform does not support threading OR forking." print "Exiting..." sys.exit(1) mixin = SocketServer.ForkingMixIn # We can't thread but we can fork ######################################################################################## class HTTPServer(mixin, BaseHTTPServer.HTTPServer): # This is just to make sure we're pass # using the mixin we selected class inputHandler(BaseHTTPRequestHandler): """Overides the BaseHTTPRequestHandler to handle incoming requests """ def do_GET(self): print "GET Hit" def go_POST(self): print "POST Hit" def server_start(): server = HTTPServer(('', 80), inputHandler) print "Serving..." server.serve_forever() # HTTP server set off here if __name__ == "__main__": server_start() Hope that helps Matt _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com _______________________________________________ ActivePython mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython