I've got a socket server that is built to handle some basic requests, and send back some data to the client. The problem is, that over time, the number of open file handles for my process, keeps increasing--2(one read,one write) for each request the server recieves. I am wondering if I am running the server, and not handling the closing of sockets well(if at all). See code below.
FYI -on the client side, I am ending requests with a socket.shutdown(2) --but it does not seem to matter what method I use to close the client side, the server side still leaves the open file handles.

I am implementing it in this fashion:

Code:
def server(host,port):
    try:
        s = SocketServer.TCPServer((host,port),reader)
        s.serve_forever()
    except:
        pass
class reader(SocketServer.BaseRequestHandler):
        def handle(self):
                data = self.request.recv(7)
                gc.collect()
                if data == "how r u":
                        send = "fine"
                        self.request.sendall(send)

I am sure this will be obvious to anyone familiar with this, but I am at a loss on how to clean up these open file handles.


Thanks in advance for any input you have--