title: sending message to a client using SocketServer in python
body: <p>I'm building a TCP server using the SocketServer module in python.</p>
  
  <p>As it seems to me, SocketServer.TCPServer functionality is destined to reply to a client that sent a request to the server but not for random communication between the server and the client. For example - Chat between the server and the client..</p>
  
  <p>Is there any way to just send a message to some client registered to the server?</p>
  
  <p>My code for now:</p>
  
  <pre><code>import SocketServer
  import chathandler
  import threading
  
  PORT = 12345
  
  def do_main():
      global httpd
  
      Handler = chathandler.ChatHandler
  
      httpd = SocketServer.TCPServer(("", PORT), Handler)
  
      print "Serving at port:", PORT
      httpd.serve_forever()
  
  if __name__ == '__main__':
      server_thread = threading.Thread(target = do_main)
      server_thread.start()
  
      while True:
          print "Send message to the clients"
          s = raw_input(": ")
          # TODO: Send the message!
  </code></pre>
  
  <p>In this example i want to send the message to all the clients connected to the server.</p>
  
  <p>Thank you!</p>