passing arguments to tcpserver classes

Eric Spaulding els24 at
Wed Jun 13 16:19:51 CEST 2007

Is there an easy way to pass arguments to a handler class that is used 
by the standard TCPServer?

normally --> srvr =SocketServer.TCPServer(('',port_num), TCPHandlerClass)

I'd like to be able to: srvr =SocketServer.TCPServer(('',port_num), 
TCPHandlerClass, (arg1,arg2))

And have arg1, arg2 available via TCPHandlerClass.__init__ or some other 

Where TCPHandlerClass:

class TCPHandlerClass(SocketServer.StreamRequestHandler):
    def handle(self):
       #handle stream events here#

Thanks for any advice.

More information about the Python-list mailing list