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


Python ProtocolWrapper.write方法代码示例

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


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

示例1: dataReceived

# 需要导入模块: from twisted.protocols.policies import ProtocolWrapper [as 别名]
# 或者: from twisted.protocols.policies.ProtocolWrapper import write [as 别名]
    def dataReceived(self, data):
        # type: (bytes) -> None
        if not self.tlsStarted:
            ProtocolWrapper.dataReceived(self, data)
            return

        self.encrypted += data

        try:
            while 1:
                decryptedData = self._decrypt()

                self._check()

                encryptedData = self._encrypt()
                ProtocolWrapper.write(self, encryptedData)

                ProtocolWrapper.dataReceived(self, decryptedData)

                if decryptedData == b'' and encryptedData == b'':
                    break
        except BIO.BIOError as e:
            # See http://www.openssl.org/docs/apps/verify.html#DIAGNOSTICS
            # for the error codes returned by SSL_get_verify_result.
            e.args = (m2.ssl_get_verify_result(self.ssl._ptr()), e.args[0])
            raise e
开发者ID:appknox,项目名称:m2crypto,代码行数:28,代码来源:TwistedProtocolWrapper.py

示例2: write

# 需要导入模块: from twisted.protocols.policies import ProtocolWrapper [as 别名]
# 或者: from twisted.protocols.policies.ProtocolWrapper import write [as 别名]
 def write(self, data):
     if not self.tlsStarted:
         ProtocolWrapper.write(self, data)
     else:
         #Because of the FakeSocket, write operations are guaranteed to
         #terminate immediately.
         AsyncStateMachine.setWriteOp(self, data)
开发者ID:20after4,项目名称:Yaki,代码行数:9,代码来源:TLSTwistedProtocolWrapper.py

示例3: _clientHello

# 需要导入模块: from twisted.protocols.policies import ProtocolWrapper [as 别名]
# 或者: from twisted.protocols.policies.ProtocolWrapper import write [as 别名]
 def _clientHello(self):
     try:
         # We rely on OpenSSL implicitly starting with client hello
         # when we haven't yet established an SSL connection
         encryptedData = self._encrypt(clientHello=1)
         ProtocolWrapper.write(self, encryptedData)
         self.helloDone = 1
     except BIO.BIOError as e:
         # See http://www.openssl.org/docs/apps/verify.html#DIAGNOSTICS
         # for the error codes returned by SSL_get_verify_result.
         e.args = (m2.ssl_get_verify_result(self.ssl._ptr()), e.args[0])
         raise e
开发者ID:appknox,项目名称:m2crypto,代码行数:14,代码来源:TwistedProtocolWrapper.py

示例4: write

# 需要导入模块: from twisted.protocols.policies import ProtocolWrapper [as 别名]
# 或者: from twisted.protocols.policies.ProtocolWrapper import write [as 别名]
    def write(self, data):
        if not self.tlsStarted:
            ProtocolWrapper.write(self, data)
            return

        try:
            encryptedData = self._encrypt(data)
            ProtocolWrapper.write(self, encryptedData)
            self.helloDone = 1
        except M2Crypto.BIO.BIOError as e:
            # See http://www.openssl.org/docs/apps/verify.html#DIAGNOSTICS
            # for the error codes returned by SSL_get_verify_result.
            e.args = (m2.ssl_get_verify_result(self.ssl._ptr()), e.args[0])
            raise e
开发者ID:makinacorpus,项目名称:M2Crypto,代码行数:16,代码来源:TwistedProtocolWrapper.py

示例5: actuallyWrite

# 需要导入模块: from twisted.protocols.policies import ProtocolWrapper [as 别名]
# 或者: from twisted.protocols.policies.ProtocolWrapper import write [as 别名]
    def actuallyWrite(self):
        if self.writeLimit is None:
            data = self.buf
            self.buf = ''
        else:
            data = self.buf[:self.writeLimit]
            self.buf = self.buf[self.writeLimit:]

        ProtocolWrapper.write(self, data)

        if data != '':
            self.writesOutstanding = True
            reactor.callLater(1, self.actuallyWrite)
        else:
            self.writesOutstanding = False
            if self.loseConnectionWhenReady:
                self.actuallyLoseConnection()
开发者ID:inglesp,项目名称:async-intro,代码行数:19,代码来源:slowserver.py

示例6: send

# 需要导入模块: from twisted.protocols.policies import ProtocolWrapper [as 别名]
# 或者: from twisted.protocols.policies.ProtocolWrapper import write [as 别名]
 def send(self, data):
     ProtocolWrapper.write(self.wrapper, data)
     return len(data)
开发者ID:20after4,项目名称:Yaki,代码行数:5,代码来源:TLSTwistedProtocolWrapper.py


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