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
haython
V2EX  ›  Python

python 如何保持单个连接不断开?

  •  
  •   haython · 2015-02-05 22:23:31 +08:00 · 3115 次点击
    这是一个创建于 3369 天前的主题,其中的信息可能已经有所发展或是发生改变。
    在弄苹果的推送,使用的socket, ssl.wrap_socket,创建一个连接之后写入,只能发送一次数据,第二次就会失败。各种搜索,搞不定了,求助啊
    第 1 条附言  ·  2015-02-05 23:27:05 +08:00
    tcp不主动断开,就是连接的状态,失败的原因是因为有错误的token


    http://blog.csdn.net/tlq1988/article/details/9612237
    3 条回复    2015-03-03 00:18:42 +08:00
    surewen
        1
    surewen  
       2015-02-06 09:20:10 +08:00 via iPhone   ❤️ 1
    理论上是可以多次推送的 但如果你推送的是无效的push id(比如用户已经卸载的)苹果就会抛异常 然后就需要你重新建立socket(以前不这样)

    正确的做法是自己维护一份无效push id的list ,人工跳过 确保发到那边的都尽可能是有效的push id
    fanta
        2
    fanta  
       2015-02-06 10:45:49 +08:00
    心跳.
    tolerious
        3
    tolerious  
       2015-03-03 00:18:42 +08:00 via iPhone
    @fanta 具体?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1110 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 23:20 · PVG 07:20 · LAX 16:20 · JFK 19:20
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.