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


Python ThreadingTCPServer.__init__方法代码示例

本文整理汇总了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" 
开发者ID:joxeankoret,项目名称:nightmare,代码行数:21,代码来源:__init__.py

示例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 
开发者ID:Sandmann79,项目名称:xbmc,代码行数:19,代码来源:proxy.py

示例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 
开发者ID:glmcdona,项目名称:meddle,代码行数:5,代码来源:config.py

示例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__ 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:11,代码来源: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:IronLanguages,项目名称:ironpython2,代码行数:9,代码来源:test_logging.py

示例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 
开发者ID:cguZZman,项目名称:script.module.clouddrive.common,代码行数:5,代码来源:base.py

示例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 
开发者ID:ofermend,项目名称:medicare-demo,代码行数:9,代码来源:config.py

示例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 
开发者ID:ofermend,项目名称:medicare-demo,代码行数:8,代码来源:test_logging.py


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