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


Python mosq_test.gen_pubcomp函数代码示例

本文整理汇总了Python中mosq_test.gen_pubcomp函数的典型用法代码示例。如果您正苦于以下问题:Python gen_pubcomp函数的具体用法?Python gen_pubcomp怎么用?Python gen_pubcomp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1:

rc = 1
keepalive = 60
connect_packet = mosq_test.gen_connect("bridge-u-test", keepalive=keepalive)
connack_packet = mosq_test.gen_connack(rc=0)

mid = 180
mid_unknown = 2000

publish_packet = mosq_test.gen_publish("bridge/unknown/qos2", qos=1, payload="bridge-message", mid=mid)
puback_packet = mosq_test.gen_puback(mid)

pubrec_packet_unknown1 = mosq_test.gen_pubrec(mid_unknown+1)
pubrel_packet_unknown1 = mosq_test.gen_pubrel(mid_unknown+1)

pubrel_packet_unknown2 = mosq_test.gen_pubrel(mid_unknown+2)
pubcomp_packet_unknown2 = mosq_test.gen_pubcomp(mid_unknown+2)

pubcomp_packet_unknown3 = mosq_test.gen_pubcomp(mid_unknown+3)


unsubscribe_packet = mosq_test.gen_unsubscribe(1, "bridge/#")
unsuback_packet = mosq_test.gen_unsuback(1)


if os.environ.get('MOSQ_USE_VALGRIND') is not None:
    sleep_time = 5
else:
    sleep_time = 0.5


sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
开发者ID:PierreF,项目名称:mosquitto,代码行数:31,代码来源:06-bridge-fail-persist-resend-qos2.py

示例2: dict

    sys.path.insert(0, cmd_subfolder)

import mosq_test

rc = 1
keepalive = 60
connect_packet = mosq_test.gen_connect("publish-qos2-test", keepalive=keepalive)
connack_packet = mosq_test.gen_connack(rc=0)

disconnect_packet = mosq_test.gen_disconnect()

mid = 13423
publish_packet = mosq_test.gen_publish("pub/qos2/receive", qos=2, mid=mid, payload="message")
pubrec_packet = mosq_test.gen_pubrec(mid)
pubrel_packet = mosq_test.gen_pubrel(mid)
pubcomp_packet = mosq_test.gen_pubcomp(mid)

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.settimeout(5)
sock.bind(('', 1888))
sock.listen(5)

client_args = sys.argv[1:]
env = dict(os.environ)
env['LD_LIBRARY_PATH'] = '../../lib:../../lib/cpp'
try:
    pp = env['PYTHONPATH']
except KeyError:
    pp = ''
env['PYTHONPATH'] = '../../lib/python:'+pp
开发者ID:asbr90,项目名称:EmbSysTesting-Tool,代码行数:31,代码来源:03-publish-b2c-qos2.py

示例3:

connect_packet = mosq_test.gen_connect("subpub-qos2-test", keepalive=keepalive)
connack_packet = mosq_test.gen_connack(rc=0)

mid = 1
subscribe_packet = mosq_test.gen_subscribe(mid, "subpub/qos2", 2)
suback_packet = mosq_test.gen_suback(mid, 2)

helper_connect = mosq_test.gen_connect("helper", keepalive=keepalive)
helper_connack = mosq_test.gen_connack(rc=0)

mid = 1
publish1s_packet = mosq_test.gen_publish("subpub/qos2", qos=2, mid=mid, payload="message")
pubrec1s_packet = mosq_test.gen_pubrec(mid)
pubrel1s_packet = mosq_test.gen_pubrel(mid)
pubcomp1s_packet = mosq_test.gen_pubcomp(mid)

mid = 1
publish1r_packet = mosq_test.gen_publish("subpub/qos2", qos=2, mid=mid, payload="message")
pubcomp1r_packet = mosq_test.gen_pubcomp(mid)

pingreq_packet = mosq_test.gen_pingreq()
pingresp_packet = mosq_test.gen_pingresp()

port = mosq_test.get_port()
broker = mosq_test.start_broker(filename=os.path.basename(__file__), port=port)

try:
    sock = mosq_test.do_client_connect(connect_packet, connack_packet, timeout=20, port=port)
    mosq_test.do_send_receive(sock, subscribe_packet, suback_packet, "suback")
开发者ID:physycom,项目名称:mosquitto,代码行数:29,代码来源:02-subpub-qos2-bad-pubcomp.py


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