本文整理汇总了Python中SocketServer.ThreadingTCPServer.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python ThreadingTCPServer.__init__方法的具体用法?Python ThreadingTCPServer.__init__怎么用?Python ThreadingTCPServer.__init__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SocketServer.ThreadingTCPServer
的用法示例。
在下文中一共展示了ThreadingTCPServer.__init__方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from SocketServer import ThreadingTCPServer [as 别名]
# 或者: from SocketServer.ThreadingTCPServer import __init__ [as 别名]
def __init__(self, host="", port=COBRASSL_PORT, sslVerify = False, sslKey = None, sslCert = None):
CobraDaemon.__init__(self, host=host, port=COBRASSL_PORT)
sslContext = OpenSSL.SSL.Context(OpenSSL.SSL.SSLv3_METHOD)
if verbose: print "SSL: Setting up SSL (daemon)"
try:
if sslVerify:
setSslVerify(sslContext)
setSslKey(sslContext, sslKey)
setSslCert(sslContext, sslCert)
sslContext.check_privatekey()
ssock = OpenSSL.SSL.Connection(sslContext, self.socket)
ssock.set_connect_state()
self.socket = ssock
except:
raise "SSL: SSL setup failed"
示例2: __init__
# 需要导入模块: from SocketServer import ThreadingTCPServer [as 别名]
# 或者: from SocketServer.ThreadingTCPServer import __init__ [as 别名]
def __init__(self, settings):
""" Initialisation of the Proxy TCP server """
self._s = settings # Make settings available to the RequestHandler
from socket import socket, AF_INET, SOCK_STREAM
sock = socket(AF_INET, SOCK_STREAM)
while True:
try:
sock.bind(('127.0.0.1', 0))
_, port = sock.getsockname()
sock.close()
ThreadingTCPServer.__init__(self, ('127.0.0.1', port), ProxyHTTPD)
self.port = port # Save the current binded port
break
except:
pass
示例3: __init__
# 需要导入模块: from SocketServer import ThreadingTCPServer [as 别名]
# 或者: from SocketServer.ThreadingTCPServer import __init__ [as 别名]
def __init__(self, config):
self.config = ConvertingDict(config)
self.config.configurator = self
示例4: __init__
# 需要导入模块: from SocketServer import ThreadingTCPServer [as 别名]
# 或者: from SocketServer.ThreadingTCPServer import __init__ [as 别名]
def __init__(self, config):
self.config = ConvertingDict(config)
self.config.configurator = self
# Issue 12718: winpdb replaces __import__ with a Python function, which
# ends up being treated as a bound method. To avoid problems, we
# set the importer on the instance, but leave it defined in the class
# so existing code doesn't break
if type(__import__) == types.FunctionType:
self.importer = __import__
示例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, data=None):
SocketServer.TCPServer.allow_reuse_address = True
self.data = data
示例7: __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
示例8: __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