【问题标题】:ws4py appears a error in Linux systemws4py在Linux系统中出现错误
【发布时间】:2016-01-06 13:00:57
【问题描述】:

我使用 ws4py 作为 websocket 服务器。它可以在 Windows 和 Mac 上正常运行,但在 linux 系统中运行时 websocket 客户端连接到服务器时会产生 TB。谁能告诉我如何修复这个错误?

[2016-01-06 20:51:43,094] ERROR Failed to receive data
Traceback (most recent call last):
File "/home/yzliu/airtest/env/local/lib/python2.7/site-packages/ws4py/websocket.py", line 300, in once
    b = self.sock.recv(self.reading_buffer_size)
File "/home/yzliu/airtest/env/local/lib/python2.7/site-packages/gevent/_socket2.py", line 264, in recv
    return sock.recv(*args)
File "/home/yzliu/airtest/env/local/lib/python2.7/site-packages/gevent/_socket2.py", line 73, in _dummy
raise error(EBADF, 'Bad file descriptor')

【问题讨论】:

  • 示例代码?请。
  • def start_ws4py_server(): server = WSGIServer(('', 9002), WebSocketWSGIApplication(handler_cls=WebSocket_Handler)) server.serve_forever() if name == 'main': configure_logger() start_ws4py_server()
  • 没有人,修改/编辑帖子并在其中包含代码。请缩进。

标签: python linux websocket ws4py wsgiserver


【解决方案1】:

这是 ws4py 中的一个错误,当与 gevent 1.1 一起使用时,作为底层 WSGI 处理程序返回时套接字关闭。

见:https://github.com/Lawouach/WebSocket-for-Python/pull/180/files

【讨论】:

  • 虽然此链接可能会回答问题,但最好在此处包含答案的基本部分并提供链接以供参考。如果链接页面发生更改,仅链接的答案可能会失效
猜你喜欢
  • 2018-08-23
  • 2020-09-21
  • 2012-05-24
  • 2022-01-10
  • 1970-01-01
  • 2019-05-21
  • 1970-01-01
  • 1970-01-01
  • 2019-05-09
相关资源
最近更新 更多