V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
ray1888
V2EX  ›  Python

asyncio socket 的接收问题

  •  
  •   ray1888 ·
    ray1888 · 2017-10-25 17:53:17 +08:00 · 1620 次点击
    这是一个创建于 2368 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我使用官方 tutourial 的 18.5.5.7.2. TCP echo server using streams url 是 https://docs.python.org/3/library/asyncio-protocol.html

    然后发送一堆 4 个 json 数据,但是这个 tutourial 只能无限循环第一个,这是为什么呢?

    接收结果: {"duration": 6909, "timestamp": 1508925087312791, "annotations": [{"host": null, "value": "GET", "key": "http.method", "annotation_type": 6}, {"host": null, "value": "http://localhost:8081/format", "key": "http.url", "annotation_type": 6}], "name": "formatString", "parent_id": 2405405279606511970}{"duration": 5586, "timestamp": 1508925087320016, "annotations": [{"host": null, "value": "GET", "key": "http.method", "annotation_type": 6}, {"host": null, "value": "http://localhost:8082/publish", "key": "http.url", "annotation_type": 6}], "name": "printHello", "parent_id": 2405405279606511970}{"duration": 13221, "timestamp": 1508925087312715, "annotations": [{"host": null, "value": "const", "key": "sampler.type", "annotation_type": 6}, {"host": null, "value": "True", "key": "sampler.param", "annotation_type": 6}, {"host": null, "value": "Python-3.6.1", "key": "jaeger.version", "annotation_type": 6}, {"host": null, "value": "workvm", "key": "jaeger.hostname", "annotation_type": 6},

    发送的数据为: {'duration': 6909, 'timestamp': 1508925087312791, 'annotations': [{'host': None, 'value': 'GET', 'key': u'http.method', 'annotation_type': 6}, {'host': None, 'value': 'http://localhost:8081/format', 'key': u'http.url', 'annotation_type': 6}], 'name': u'formatString', 'parent_id': 2405405279606511970}

    {'duration': 5586, 'timestamp': 1508925087320016, 'name': u'printHello', 'parent_id': 2405405279606511970, 'annotations': [{'host': None, 'key': u'http.method', 'value': 'GET', 'annotation_type': 6}, {'host': None, 'key': u'http.url', 'value': 'http://localhost:8082/publish', 'annotation_type': 6}]}

    {'duration': 13221, 'timestamp': 1508925087312715, 'name': u'say-hello', 'parent_id': None, 'annotations': [{'host': None, 'key': u'sampler.type', 'value': 'const', 'annotation_type': 6}, {'host': None, 'key': u'sampler.param', 'value': 'True', 'annotation_type': 6}, {'host': None, 'key': u'jaeger.version', 'value': 'Python-3.6.1', 'annotation_type': 6}, {'host': None, 'key': u'jaeger.hostname', 'value': 'workvm', 'annotation_type': 6}, {'host': None, 'key': u'hello-to', 'value': 'yyy123', 'annotation_type': 6}]}

    {

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2287 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 00:42 · PVG 08:42 · LAX 17:42 · JFK 20:42
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.