• Guido van Rossum's avatar
    SF Patch #102980, by Luke Kenneth Casson Leighton: BaseServer class · 90cb9067
    Guido van Rossum authored
    for SocketServer.py (inherited by TCPServer)
    
    Luke wrote:
    
      The socketserver code, with a little bit of tweaking, can be made
      sufficiently general to service "requests" of any kind, not just by sockets.
      The BaseServer class was created, for example, to poll a table in a MYSQL
      database every 2 seconds. each entry in the table can be allocated a
      Handler which deals with the entry.
    
      With this patch, using BaseServer and ThreadedServer classes, the creation
      of the server that reads and handles MySQL table entries instead of a
      socket was utterly trivial: about 50 lines of python code.
    
      You may consider this code to be utterly useless [why would anyone else
      want to do anything like this???] - you are entitled to your opinion. if you
      think so, then think of this: have you considered how to cleanly add SSL to
      the TCPSocketServer? What about using shared memory as the
      communications mechanism for a server, instead of sockets? What about
      communication using files?
    
      The SocketServer code is extremely good every useful. it's just that as it
      stands, it is tied to sockets, which is not as useful.
    
    I heartily approve of this idea.
    90cb9067
SocketServer.py 16.1 KB