提问人:arman 提问时间:2/15/2015 更新时间:2/15/2015 访问量:396
带 UDP 连接的 gevent 套接字
gevent socket with UDP connection
问:
我在这个问题上花了很多时间,但我无法弄清楚出了什么问题。
我在python中有两个程序。P1 程序使用 gevent socket modeul 创建两种类型的连接,即 TCP 和 UDP。每个连接都在单独的绿色中创建。程序 1 运行正常。
然后我还有另一个程序 P2,它使用 gevent 子进程中的 Popen 来调用 P1 作为外部程序,如下所示:
sub = Popen("python p1.py 1", stdout = PIPE, stderr=STDOUT, shell=True)
当 P1 启动时,具有 UDP 连接的 greenlet 崩溃并出现以下错误:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/gevent/greenlet.py", line 327, in run
result = self.run(self.args, *self.kwargs)
File "gtest_runner.py", line 883, in run
self.sock.sendto(data, master_addr)
File "/usr/local/lib/python2.7/dist-packages/gevent/socket.py", line 475, in sendto
ret_val = sock.sendto(*args)
TypeError: an integer is required
<Greenlet at 0x7f86a0140730: <bound method Beacon.run of <__main_.Beacon instance at 0x7f86a2c4aa28>>> failed with TypeError
我在 ubuntu 2.7 上使用 Python 14。
期待的感谢!
答: 暂无答案
评论
subprocess
master_addr
sendto