title: Python socket receive - incoming packets always have a different size
body: <p>I'm using the SocketServer module for a TCP server.
  I'm experiencing some issue here with the <code>recv()</code> function, because the incoming packets always have a different size, so if I specify <code>recv(1024)</code> (I tried with a bigger value, and smaller), it gets stuck after 2 or 3 requests because the packet length will be smaller (I think), and then the server gets stuck until a timeout.</p>
  
  <pre><code>class Test(SocketServer.BaseRequestHandler):
  
  def handle(self):
  
     print "From:", self.client_address
  
     while True:    
  
       data = self.request.recv(1024)
       if not data: break
  
       if data[4] == "\x20":              
         self.request.sendall("hello")
       if data[4] == "\x21":
         self.request.sendall("bye")
       else:
         print "unknow packet"
     self.request.close()
     print "Disconnected", self.client_address
  
  launch = SocketServer.ThreadingTCPServer(('', int(sys.argv[1])),Test)
  
  launch.allow_reuse_address= True;
  
  launch.serve_forever()
  </code></pre>
  
  <p>If the client sends multiples requests over the same source port, but the server gets stuck, any help would be very appreciated, thank !    </p>