当前位置: 首页>>代码示例>>Python>>正文


Python ThreadingTCPServer.__init__方法代码示例

本文整理汇总了Python中SocketServer.ThreadingTCPServer.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python ThreadingTCPServer.__init__方法的具体用法?Python ThreadingTCPServer.__init__怎么用?Python ThreadingTCPServer.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SocketServer.ThreadingTCPServer的用法示例。


在下文中一共展示了ThreadingTCPServer.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from SocketServer import ThreadingTCPServer [as 别名]
# 或者: from SocketServer.ThreadingTCPServer import __init__ [as 别名]
 def __init__(self, address, handler):
     self._logger = logging.getLogger('GlobalTCPServer')
     self._logger.debug('__init__')
     self._command_set = { 0 : self.subscribe,
                           1 : self.unsubscribe,
                           8 : self.start_correlator,
                           9 : self.stop_correlator,
                           10 : self.get_integration_time,
                           11 : self.set_integration_time,
                           32 : self.get_phase_offsets,
                           33 : self.set_phase_offsets,
                           34 : self.get_delay_offsets,
                           35 : self.set_delay_offsets,
                           ##TODO
                           36 : self.get_algorithm,
                           37 : self.set_algorithm,
                           
                           255 : self.shutdown,
                          }
     self._started = False
     self._n_antennas = 8
     self._integration_time = 16 #sec
     
     self.antennas_remaping = {0:6, 1:1, 2:2, 3:3, 4:4, 5:5, 6:7, 7:8}
     
     self._correlator = None #TODO-2
     self._delay_control = SingleBlockmappingDelayControl({"/dev/ttyS4" : (6,1,2,3), "/dev/ttyS5" : (4,5,7,8)})
     
     self._stop_spread_event = Event()
             
     ThreadingTCPServer.__init__(self, address, handler)
开发者ID:sma-wideband,项目名称:phringes,代码行数:33,代码来源:server.py

示例2: __init__

# 需要导入模块: from SocketServer import ThreadingTCPServer [as 别名]
# 或者: from SocketServer.ThreadingTCPServer import __init__ [as 别名]
 def __init__(
     self, host="localhost", port=logging.handlers.DEFAULT_TCP_LOGGING_PORT, handler=LogRecordStreamHandler
 ):
     ThreadingTCPServer.__init__(self, (host, port), handler)
     self.abort = 0
     self.timeout = 1
     self.logname = None
开发者ID:bebestmaple,项目名称:Hammer,代码行数:9,代码来源:logrecv.py

示例3: __init__

# 需要导入模块: from SocketServer import ThreadingTCPServer [as 别名]
# 或者: from SocketServer.ThreadingTCPServer import __init__ [as 别名]
    def __init__(self, host="", port=COBRA_PORT, sslcrt=None, sslkey=None, sslca=None, msgpack=False, json=False):
        '''
        Construct a cobra daemon object.

        Parameters:
        host        - Optional hostname/ip to bind the service to (default: inaddr_any)
        port        - The port to bind (Default: COBRA_PORT)
        msgpack     - Use msgpack serialization

        # SSL Options
        sslcrt / sslkey     - Specify sslcrt and sslkey to enable SSL server side
        sslca               - Specify an SSL CA key to use validating client certs

        '''
        self.thr = None
        self.run = True
        self.shared = {}
        self.dowith = {}
        self.host = host
        self.port = port
        self.reflock = RLock()
        self.refcnts = {}
        self.authmod = None
        self.sflags = 0

        if msgpack and json:
            raise Exception('CobraDaemon can not use both msgpack *and* json!')

        if msgpack:
            requireMsgpack()
            self.sflags |= SFLAG_MSGPACK

        if json:
            self.sflags |= SFLAG_JSON

        # SSL Options
        self.sslca = sslca
        self.sslcrt = sslcrt
        self.sslkey = sslkey

        self.cansetattr = True
        self.cangetattr = True

        if sslcrt and not os.path.isfile(sslcrt):
            raise Exception('CobraDaemon: sslcrt param must be a file!')

        if sslkey and not os.path.isfile(sslkey):
            raise Exception('CobraDaemon: sslkey param must be a file!')

        if sslca and not os.path.isfile(sslca):
            raise Exception('CobraDaemon: sslca param must be a file!')

        self.allow_reuse_address = True
        ThreadingTCPServer.__init__(self, (host, port), CobraRequestHandler)

        if port == 0:
            self.port = self.socket.getsockname()[1]

        self.daemon_threads = True
        self.recvtimeout = None
开发者ID:BwRy,项目名称:vivisect,代码行数:62,代码来源:__init__.py

示例4: __init__

# 需要导入模块: from SocketServer import ThreadingTCPServer [as 别名]
# 或者: from SocketServer.ThreadingTCPServer import __init__ [as 别名]
 def __init__(self, host='localhost', port=DEFAULT_LOGGING_CONFIG_PORT,
              handler=None):
     ThreadingTCPServer.__init__(self, (host, port), handler)
     logging._acquireLock()
     self.abort = 0
     logging._releaseLock()
     self.timeout = 1
开发者ID:CovenantEyes,项目名称:gunicorn,代码行数:9,代码来源:logging_config.py

示例5: __init__

# 需要导入模块: from SocketServer import ThreadingTCPServer [as 别名]
# 或者: from SocketServer.ThreadingTCPServer import __init__ [as 别名]
 def __init__(self, host='localhost',
                          port=logging.handlers.DEFAULT_TCP_LOGGING_PORT,
                  handler=LogRecordStreamHandler):
     ThreadingTCPServer.__init__(self, (host, port), handler)
     self.abort = False
     self.timeout = 0.1
     self.finished = threading.Event()
开发者ID:CRYPTOlab,项目名称:python-resin,代码行数:9,代码来源:test_logging.py

示例6: __init__

# 需要导入模块: from SocketServer import ThreadingTCPServer [as 别名]
# 或者: from SocketServer.ThreadingTCPServer import __init__ [as 别名]
 def __init__(self, port, deviceFd, deviceLock, debug = False, aexServer = None):
     '''
     Constructor
     '''
     self.running = False
     
     self.__dataQueue = Queue(0)
     
     self.__clients = []
     self.debug = debug
     
     self.__deviceFd = deviceFd
     self.deviceLock = deviceLock
     self.aexServer=aexServer
     
     self.runningTime = 0
     self.receivingTime = 0
     self.packetsReceived = 0
     self.sleepingTimes = 0
     
     ThreadingTCPServer.__init__(self, ("", port), StimNetCom, False)
     
     ThreadingTCPServer.allow_reuse_address = True
     
     self.server_bind()
     self.server_activate()
     
     Thread.__init__(self)
开发者ID:federicohyo,项目名称:mn256r1_ncs,代码行数:30,代码来源:StimServer.py

示例7: __init__

# 需要导入模块: from SocketServer import ThreadingTCPServer [as 别名]
# 或者: from SocketServer.ThreadingTCPServer import __init__ [as 别名]
	def __init__(self):
		self.log = logging.getLogger();
		self.log.setLevel(logging.DEBUG);
		log_hdl = logging.StreamHandler();
		log_hdl.setFormatter(logging.Formatter( '%(asctime)s %(levelname)s %(message)s' ))
		self.log.addHandler(log_hdl);
		self.allow_reuse_address = True;
		ThreadingTCPServer.__init__(self, ('', 21), self.BackConnectHandler);
开发者ID:rass89rus,项目名称:linux-iptables-contrack-exploit,代码行数:10,代码来源:fake-server.py

示例8: __init__

# 需要导入模块: from SocketServer import ThreadingTCPServer [as 别名]
# 或者: from SocketServer.ThreadingTCPServer import __init__ [as 别名]
 def __init__(self, port, auth=False, user_manager=UserManager(), allowed=None):
     ThreadingTCPServer.__init__(self, ('', port), Socks5RequestHandler)
     self.__port = port
     self.__users = {}
     self.__auth = auth
     self.__user_manager = user_manager
     self.__sessions = {}
     self.allowed = allowed
开发者ID:fengyouchao,项目名称:pysocks,代码行数:10,代码来源:socks5.py

示例9: __init__

# 需要导入模块: from SocketServer import ThreadingTCPServer [as 别名]
# 或者: from SocketServer.ThreadingTCPServer import __init__ [as 别名]
 def __init__(self, server_address, RequestHandlerClass, key, opts): 
     ThreadingTCPServer.__init__(self, server_address,
                                 RequestHandlerClass)
     self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR,
                            1)
     self.key = key
     self.opts = opts
     self.initSecurity()
开发者ID:danieljohnlewis,项目名称:pisces,代码行数:10,代码来源:ttls_server.py

示例10: __init__

# 需要导入模块: from SocketServer import ThreadingTCPServer [as 别名]
# 或者: from SocketServer.ThreadingTCPServer import __init__ [as 别名]
    def __init__(self, handler):
        #
        # We assume the server to be listening on local socket only, as we want 
	# to have an easy and fast access to the recorded by Asterisk files,
        # easily pass own prompt files, etc
        #
        self.allow_reuse_address = True
        ThreadingTCPServer.__init__(self, ("127.0.0.1", 4573), handler)
开发者ID:sippy,项目名称:vapp,代码行数:10,代码来源:sample-ivrd.py

示例11: __init__

# 需要导入模块: from SocketServer import ThreadingTCPServer [as 别名]
# 或者: from SocketServer.ThreadingTCPServer import __init__ [as 别名]
 def __init__(self, serverInfo, EchoHandler, log):
     '''
     Constructor
     '''
     self.name = "address-" + serverInfo[0] + "-port-" + str(serverInfo[1])
     self.log = log
     self.flood('DistributedStorageBenchmarkServer is being instantiated and initialized: ' + self.name)
     ThreadingTCPServer.__init__(self, serverInfo, EchoHandler)
     self.flood(self.name + ' is done initializing.')
开发者ID:shadoobie,项目名称:dbench,代码行数:11,代码来源:DistributedStorageBenchmarkServer.py

示例12: __init__

# 需要导入模块: from SocketServer import ThreadingTCPServer [as 别名]
# 或者: from SocketServer.ThreadingTCPServer import __init__ [as 别名]
 def __init__(self, log_level=log.INFO, ip='0.0.0.0', port=5000, prune_inactive=PRUNE_IDLE_SECS):
     log.basicConfig(level=log_level)
     self.games = {}
     self.lock = RLock()
     self.allow_reuse_address = True
     self.prune_inactive = prune_inactive
     ThreadingTCPServer.__init__(self, (ip, port), RequestHandler)
     self.host, self.port = self.server_address
     log.info('started server on %s:%s', self.host, self.port)
开发者ID:batkinson,项目名称:checkers,代码行数:11,代码来源:threaded_server.py

示例13: __init__

# 需要导入模块: from SocketServer import ThreadingTCPServer [as 别名]
# 或者: from SocketServer.ThreadingTCPServer import __init__ [as 别名]
 def __init__(self, clientHost, clientPort):
     SimpleXMLRPCDispatcher.__init__(self)
     ThreadingTCPServer.__init__(self,
                                 (clientHost, clientPort),
                                 SimpleXMLRPCRequestHandler)
     self.logRequests = 1
     self.client = AdminControlInterface()
     self.register_introspection_functions()
     self.register_instance(self.client)
开发者ID:giffels,项目名称:PRODAGENT,代码行数:11,代码来源:AdminControlServer.py

示例14: __init__

# 需要导入模块: from SocketServer import ThreadingTCPServer [as 别名]
# 或者: from SocketServer.ThreadingTCPServer import __init__ [as 别名]
    def __init__(self, addr, requestHandler=DroidPresRequestHandler, logRequests=False, allow_none=False, encoding=None, bind_and_activate=True):
        self.logRequests = logRequests

        SimpleXMLRPCDispatcher.__init__(self, allow_none, encoding)
        ThreadingTCPServer.__init__(self, addr, requestHandler, bind_and_activate)

        if fcntl is not None and hasattr(fcntl, 'FD_CLOEXEC'):
            flags = fcntl.fcntl(self.fileno(), fcntl.F_GETFD)
            flags |= fcntl.FD_CLOEXEC
            fcntl.fcntl(self.fileno(), fcntl.F_SETFD, flags)
开发者ID:Alex-Fill,项目名称:droidpres,代码行数:12,代码来源:xmlrpcserver.py

示例15: __init__

# 需要导入模块: from SocketServer import ThreadingTCPServer [as 别名]
# 或者: from SocketServer.ThreadingTCPServer import __init__ [as 别名]
 def __init__(self,
              server_address,
              RequestHandlerClass,
              dbpath,
              bind_and_activate=True):
     ThreadingTCPServer.__init__(
         self,
         server_address,
         RequestHandlerClass,
         bind_and_activate=True)
     self.dbpath = dbpath
开发者ID:radiocicletta,项目名称:Scriptcicletti,代码行数:13,代码来源:catalog.py


注:本文中的SocketServer.ThreadingTCPServer.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。