本文整理汇总了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)
示例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
示例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
示例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
示例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()
示例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)
示例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);
示例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
示例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()
示例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)
示例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.')
示例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)
示例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)
示例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)
示例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