title: python socketserver timeout
body: <p>I'm implementing a simple server which should print a message if nothing is received for 3 seconds.  </p>
  
  <p><strong>Handler</strong></p>
  
  <pre><code>class SingleTCPHandler(SocketServer.StreamRequestHandler):
      def handle(self):
          while True:
              message = self.rfile.readline().strip()
              print message
  </code></pre>
  
  <p><strong>Server</strong></p>
  
  <pre><code>class SimpleServer(SocketServer.TCPServer):
      timeout = 3
  
      def handle_timeout(self):
          print "Timeout"
  
      def __init__(self, server_address, RequestHandlerClass):
          SocketServer.TCPServer.__init__(self, server_address, RequestHandlerClass)
  </code></pre>
  
  <p>Here I'm extending the <code>TCPServer</code> for testing the timeout method.
  I've set the <code>timeout</code> atribute to <code>3</code>. According to the docs, if that time passes and no messages are sent to the client <code>handle_timeout()</code> is called which, in my case, just prints 'Timeout'.</p>
  
  <blockquote>
    <p>BaseServer.timeout</p>
    
    <p>Timeout duration, measured in seconds, or None if no timeout is desired. 
     If handle_request() receives no incoming requests within the
     timeout period, the handle_timeout() method is called.</p>
  </blockquote>
  
  <p>I start the server, and observe it's output. When i connect to it and send some messages, they are normally printed. However, if I don't send anything for 3 seconds or more, nothing happens. As if the <code>timeout</code> and <code>handle_timeout()</code> haven't been implemented. </p>
  
  <p>What could be the source of this behavior?</p>