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


Python Client.pair方法代码示例

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


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

示例1: test_pair_client_cannot_connect_more_than_once

# 需要导入模块: from zeroless import Client [as 别名]
# 或者: from zeroless.Client import pair [as 别名]
    def test_pair_client_cannot_connect_more_than_once(self):
        client = Client()
        client.connect_local(port=7200)
        client.connect_local(port=7201)

        with pytest.raises(RuntimeError):
            client.pair()

        client = Client()
        client.connect_local(port=7200)

        client.pair()

        with pytest.raises(RuntimeError):
            client.connect_local(port=7201)
开发者ID:davinirjr,项目名称:zeroless,代码行数:17,代码来源:test_exceptions.py

示例2: pair

# 需要导入模块: from zeroless import Client [as 别名]
# 或者: from zeroless.Client import pair [as 别名]
def pair():
    client = Client()
    client.connect_local(port=7890)
    send, _ = client.pair()
    return send
开发者ID:EnTeQuAk,项目名称:python-zeroless,代码行数:7,代码来源:test_pair.py

示例3: import

# 需要导入模块: from zeroless import Client [as 别名]
# 或者: from zeroless.Client import pair [as 别名]
import logging

from zeroless import (Client, log)

# Setup console logging
consoleHandler = logging.StreamHandler()
log.setLevel(logging.DEBUG)
log.addHandler(consoleHandler)

# Connects the client to a single server
client = Client()
client.connect_local(port=12345)

# Initiate a pair client
# And assigns a callable and an iterable
# To both transmit and wait for incoming messages
pair, listen_for_pair = client.pair()

for msg in [b"Msg1", b"Msg2", b"Msg3"]:
    pair(msg)
    response = next(listen_for_pair)
    print(response)
开发者ID:EnTeQuAk,项目名称:python-zeroless,代码行数:24,代码来源:pairClient.py

示例4: Client

# 需要导入模块: from zeroless import Client [as 别名]
# 或者: from zeroless.Client import pair [as 别名]
from zeroless import Client

# Connects the client to a single server
client = Client()
client.connect_local(port=12345)

# Initiate a pair client
# And assigns a callable to transmit messages
pair, _ = client.pair()

for id, msg in [(b"1", b"Msg1"), (b"2", b"Msg2"), (b"3", b"Msg3")]:
    pair(id, msg)
开发者ID:davinirjr,项目名称:zeroless,代码行数:14,代码来源:pairClient.py


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