如何开始使用 Python SCTP 堆栈 (pysctp)?
我刚刚从 http://www.epx.com.br/pysctp/,并且我无法使基本示例正常工作。我可能做错了什么?
我使用的是红帽 Linux。
Python 2.7.2 (default, Oct 25 2011, 10:11:43)
[GCC 4.1.2 20070626 (Red Hat 4.1.2-14)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> import sctp
>>> sk = sctp.sctpsocket_tcp(socket.AF_INET)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/python2.7/lib/python2.7/site-packages/sctp.py", line 1644, in __init__
sctpsocket.__init__(self, family, TCP_STYLE, sk)
File "/usr/local/python2.7/lib/python2.7/site-packages/sctp.py", line 1016, in __init__
self.events = event_subscribe(self)
File "/usr/local/python2.7/lib/python2.7/site-packages/sctp.py", line 623, in __init__
self.__dict__.update(self.container._get_events())
File "/usr/local/python2.7/lib/python2.7/site-packages/sctp.py", line 1356, in _get_events
return _sctp.get_events(self._sk.fileno())
IOError: [Errno 22] Invalid argument
I've just installed pysctp from http://www.epx.com.br/pysctp/, and I'm having trouble getting the basic example working. What could I be doing wrong?
I'm on Red Hat Linux.
Python 2.7.2 (default, Oct 25 2011, 10:11:43)
[GCC 4.1.2 20070626 (Red Hat 4.1.2-14)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> import sctp
>>> sk = sctp.sctpsocket_tcp(socket.AF_INET)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/python2.7/lib/python2.7/site-packages/sctp.py", line 1644, in __init__
sctpsocket.__init__(self, family, TCP_STYLE, sk)
File "/usr/local/python2.7/lib/python2.7/site-packages/sctp.py", line 1016, in __init__
self.events = event_subscribe(self)
File "/usr/local/python2.7/lib/python2.7/site-packages/sctp.py", line 623, in __init__
self.__dict__.update(self.container._get_events())
File "/usr/local/python2.7/lib/python2.7/site-packages/sctp.py", line 1356, in _get_events
return _sctp.get_events(self._sk.fileno())
IOError: [Errno 22] Invalid argument
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
有人破坏了 ABI(向 struct sctp_event_subscribe 添加了更多字段,并且内核希望用户空间想要新的数量)。这是一个拼凑,正确的修复方法是让内核接受已针对具有较小 struct_event_subscribe 的标头进行编译的旧应用程序,而不是向它们提供新字段...)。或者甚至更新到 lksctp-devel 中的新样式标头并重新编译所有内容。
Someone broke the ABI (added a few more fields to struct sctp_event_subscribe and the kernel wants userspace to want the new amount). Here's a kludge, proper fix would be for the kernel to accept old apps that have been compiled against headers with a smaller struct_event_subscribe and just not give them the new fields...). Or even updating to the new-style header in lksctp-devel and recompiling everything.
看起来像是 pysctp 内部的错误。
get_events
调用getsockopt
。getsockopt(2) 说:
Looks like a bug internal to
pysctp
.get_events
callsgetsockopt
.getsockopt(2)
says:Brian 是对的 - 为 SCTP_EVENTS 调用
getsockopt
时出现了某种问题。我无法解决这个问题,但我在 sctp.py 中注释掉了这一行:然后 SCTP 套接字似乎工作正常。我还不需要获取 SCTP_EVENTS,所以现在就可以了。
Brian's right - there's some sort of issue calling
getsockopt
for SCTP_EVENTS. I've not been able to solve that, but I've commented out this line in sctp.py:The SCTP sockets then seem to work fine. I've not yet needed to get the SCTP_EVENTS, so this is fine for now.