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


Python ServerFactory.buildProtocol方法代码示例

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


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

示例1: unconnected_proxyserver

# 需要导入模块: from twisted.internet.protocol import ServerFactory [as 别名]
# 或者: from twisted.internet.protocol.ServerFactory import buildProtocol [as 别名]
def unconnected_proxyserver(mocker):
    mocker.patch("twisted.test.iosim.FakeTransport.startTLS")
    mocker.patch("pappyproxy.proxy.load_certs_from_dir", new=mock_generate_cert)
    factory = ServerFactory()
    factory.protocol = ProxyServer
    protocol = factory.buildProtocol(('127.0.0.1', 0))
    protocol.makeConnection(FakeTransport(protocol, True))
    return protocol
开发者ID:rjmolesa,项目名称:pappy-proxy,代码行数:10,代码来源:test_proxy.py

示例2: buildProtocol

# 需要导入模块: from twisted.internet.protocol import ServerFactory [as 别名]
# 或者: from twisted.internet.protocol.ServerFactory import buildProtocol [as 别名]
    def buildProtocol(self, address):
        """
        Builds the protocol to a given address.

        :rtype : Protocol
        """
        p = ServerFactory.buildProtocol(self, address)
        return p
开发者ID:mathsteck,项目名称:StarryPy,代码行数:10,代码来源:server.py

示例3: buildProtocol

# 需要导入模块: from twisted.internet.protocol import ServerFactory [as 别名]
# 或者: from twisted.internet.protocol.ServerFactory import buildProtocol [as 别名]
  def buildProtocol(self, addr):
    from carbon.conf import settings

    # Don't establish the connection if we have reached the limit.
    if len(state.connectedMetricReceiverProtocols) < settings.MAX_RECEIVER_CONNECTIONS:
      return ServerFactory.buildProtocol(self, addr)
    else:
      return None
开发者ID:NixM0nk3y,项目名称:carbon,代码行数:10,代码来源:protocols.py

示例4: buildProtocol

# 需要导入模块: from twisted.internet.protocol import ServerFactory [as 别名]
# 或者: from twisted.internet.protocol.ServerFactory import buildProtocol [as 别名]
  def buildProtocol(self, addr):
    clients = len(state.connectedMetricReceiverProtocols)
    max_clients = settings.MAX_RECEIVER_CONNECTIONS

    if clients < max_clients:
      return ServerFactory.buildProtocol(self, addr)
    else:
      return None
开发者ID:graphite-project,项目名称:carbon,代码行数:10,代码来源:protocols.py

示例5: buildProtocol

# 需要导入模块: from twisted.internet.protocol import ServerFactory [as 别名]
# 或者: from twisted.internet.protocol.ServerFactory import buildProtocol [as 别名]
 def buildProtocol(self, addr):
     p = ServerFactory.buildProtocol(self, addr)
     p.service = self
     self.clients[p] = {"from": addr,
                        "connected": time.time(),
                        "rx": 0,
                        "tx": 0,
                        "subscriptions": set()}
     return p
开发者ID:warner,项目名称:toolbed,代码行数:11,代码来源:relay.py

示例6: buildProtocol

# 需要导入模块: from twisted.internet.protocol import ServerFactory [as 别名]
# 或者: from twisted.internet.protocol.ServerFactory import buildProtocol [as 别名]
 def buildProtocol(self, addr):
     """
     Build the L{NodeServerProtocol} instance and add a callback when the
     connection has been successfully established to the other node.
     """
     p = ServerFactory.buildProtocol(self, addr)
     p._connectDeferred = Deferred()
     p._connectDeferred.addCallback(self._putInCache)
     return p
开发者ID:cybergrind,项目名称:twotp,代码行数:11,代码来源:server.py

示例7: buildProtocol

# 需要导入模块: from twisted.internet.protocol import ServerFactory [as 别名]
# 或者: from twisted.internet.protocol.ServerFactory import buildProtocol [as 别名]
    def buildProtocol(self, address):
        """
        Builds the protocol to a given address.

        :rtype : Protocol
        """
        logger.debug("Building protocol to address %s", address)
        p = ServerFactory.buildProtocol(self, address)
        return p
开发者ID:elmerfud,项目名称:StarryPy,代码行数:11,代码来源:server.py

示例8: buildProtocol

# 需要导入模块: from twisted.internet.protocol import ServerFactory [as 别名]
# 或者: from twisted.internet.protocol.ServerFactory import buildProtocol [as 别名]
	def buildProtocol(self, address):
		proto = ServerFactory.buildProtocol(self, address)
		self.clients[self.next_id] = proto
		if self.client_waiting is None:
			self.client_waiting = self.next_id
		else:
			self.game(self.client_waiting, self.next_id)
			self.client_waiting = None
		self.next_id += 1
		return proto
开发者ID:jonathangray92,项目名称:twisted-tictactoe,代码行数:12,代码来源:server.py

示例9: proxyserver

# 需要导入模块: from twisted.internet.protocol import ServerFactory [as 别名]
# 或者: from twisted.internet.protocol.ServerFactory import buildProtocol [as 别名]
def proxyserver(mocker):
    mocker.patch("twisted.test.iosim.FakeTransport.startTLS")
    mocker.patch("pappyproxy.proxy.load_certs_from_dir", new=mock_generate_cert)
    factory = ServerFactory()
    factory.protocol = ProxyServer
    protocol = factory.buildProtocol(('127.0.0.1', 0))
    protocol.makeConnection(FakeTransport(protocol, True))
    protocol.lineReceived('CONNECT https://www.AAAA.BBBB:443 HTTP/1.1')
    protocol.lineReceived('')
    protocol.transport.getOutBuffer()
    return protocol
开发者ID:rjmolesa,项目名称:pappy-proxy,代码行数:13,代码来源:test_proxy.py

示例10: buildProtocol

# 需要导入模块: from twisted.internet.protocol import ServerFactory [as 别名]
# 或者: from twisted.internet.protocol.ServerFactory import buildProtocol [as 别名]
    def buildProtocol(self, addr):
        password = self.settings.get('iphone', 'password')
        if password:
            protocol = ServerFactory.buildProtocol(self, addr)
            protocol.window = self.window
            protocol.settings = self.settings
            protocol.iocontroller = self.iocontroller
            return protocol

        wx.MessageBox(_('''An iPhone or iPod Touch tried to connect to Task Coach,\n'''
                        '''but no password is set. Please set a password in the\n'''
                        '''iPhone section of the configuration and try again.'''),
                        _('Error'), wx.OK)

        return None
开发者ID:pk-codebox-evo,项目名称:ios-apps-taskcoach,代码行数:17,代码来源:protocol.py

示例11: buildProtocol

# 需要导入模块: from twisted.internet.protocol import ServerFactory [as 别名]
# 或者: from twisted.internet.protocol.ServerFactory import buildProtocol [as 别名]
 def buildProtocol(self, addr):
     p = ServerFactory.buildProtocol(self, addr)
     p.context_manager = ContextManager(self.context_path)
     return p
开发者ID:yyforbidden,项目名称:EPC_Test,代码行数:6,代码来源:Copy+of+controller.py

示例12: buildProtocol

# 需要导入模块: from twisted.internet.protocol import ServerFactory [as 别名]
# 或者: from twisted.internet.protocol.ServerFactory import buildProtocol [as 别名]
 def buildProtocol(self, addr):
     p = ServerFactory.buildProtocol(self, addr)
     p.addr = addr
     return p
开发者ID:jchengl,项目名称:evo-league,代码行数:6,代码来源:__init__.py

示例13: buildProtocol

# 需要导入模块: from twisted.internet.protocol import ServerFactory [as 别名]
# 或者: from twisted.internet.protocol.ServerFactory import buildProtocol [as 别名]
 def buildProtocol(self, addr):
     protocol = ServerFactory.buildProtocol(self, addr)
     self.reactor.callLater(0, self.result.callback, protocol)
     return protocol
开发者ID:BillAndersan,项目名称:twisted,代码行数:6,代码来源:connectionmixins.py

示例14: buildProtocol

# 需要导入模块: from twisted.internet.protocol import ServerFactory [as 别名]
# 或者: from twisted.internet.protocol.ServerFactory import buildProtocol [as 别名]
 def buildProtocol(self, addr):
     protocol = ServerFactory.buildProtocol(self, addr)
     protocol.io = self.io
     self.io.addClient(protocol)
     return protocol
开发者ID:sdrendall,项目名称:conditioningCage,代码行数:7,代码来源:debuggingServer.py

示例15: buildProtocol

# 需要导入模块: from twisted.internet.protocol import ServerFactory [as 别名]
# 或者: from twisted.internet.protocol.ServerFactory import buildProtocol [as 别名]
 def buildProtocol(self, addr):
     self.logger.info('Client connected: '+repr(addr))
     return ServerFactory.buildProtocol(self, addr)
开发者ID:bepec,项目名称:wfd-toolbox,代码行数:5,代码来源:twisted_wfd_server.py


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