title: Unable to Send Large File Python
body: <p>I am trying to implement a simple epoll web server for a class.  Everything works great until I try and send a large file.  I noticed it sends about 2/3 of the data then just kind of sits there and does nothing.  This is how I try to ensure all my data is sent:</p>
  
  <pre><code>def sendResponse(self,fd,response):
      if response:
          totalsent = 0
          MSGLEN = len(response)
          while totalsent &lt; MSGLEN:
              sent = self.clients[fd].send(response[totalsent:])
              if sent == 0:
                  raise RuntimeError("socket connection broken")
              totalsent = totalsent + sent
      else:
          self.poller.unregister(fd)
          self.clients[fd].close()
          del self.clients[fd]
  </code></pre>
  
  <p>Did I mention this works on small to medium sized file.  I only noticed it breaks when trying to send files 1.7 Mbs or larger.</p>