Hi there,
i get the following error when i try to recieve from a socket Traceback (most recent call last): File "D:\backup\pythonstuff\projects\hyperd\webserver.py", line 51, in ? server.start() # '()' again File "D:\backup\pythonstuff\projects\hyperd\webserver.py", line 20, in start self.handle(ss) # Whenever calling a method from your File "D:\backup\pythonstuff\projects\hyperd\webserver.py", line 40, in handle self.getparse(ss) File "D:\backup\pythonstuff\projects\hyperd\webserver.py", line 43, in getpars e response = ss.recv(1024) File "<string>", line 1, in recv socket.error: (10057, 'Socket is not connected') Your help is much appreciated, Jer ########################################### #!python 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(1) 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 client = 0 try: client = ss.accept() # Make sure those '()' are in there except: return client return client 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" client = self.checkForConn(ss) if client: print client self.getparse(ss) def getparse(self,ss): response = ss.recv(1024) print response if __name__ == "__main__": server = webserver(80,'/') # Make sure port is passed as integer server.start() # '()' again _______________________________________________ ActivePython mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython