Jer,

The client object contains two item, one being the connection object and the 
other the remote address. It's the connection object you want to receive 
data from.

The code below should work. I stuck a close for the socket in too.

###########################################
#!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(100)
                print "\nListening..."
                self.handle(ss)


        def checkForConn(self, ss):
                client = 0
                try:
                        client = ss.accept()
                except:
                        return 0
                return client

        def handle(self, ss):
                Done = 0

                while not Done:
                        client = self.checkForConn(ss)
                        if client[0]:
                                print "Client data : ", client[0], client[1]
                                self.getparse(client)

        def getparse(self,client):
                connectionObj = client[0]
                response = connectionObj.recv(10240)
                print response

                #connectionObj.send(EnterReturnDataHere)

                self.closeConnection(connectionObj)

        def closeConnection(self, connectionObj):
                connectionObj.close()

if __name__ == "__main__":
        server = webserver(80,'/')
        server.start()

_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com

_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython

Reply via email to