UDT C++ 的 Python 包装器图书馆
I want to use the UDT library in Python, so I need a wrapper. I found this one: pyudt, but I dont know exactly how to use this to send files from a peer to peer. Can anybody point me in the right direction?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
经过这么多时间我发现了这个问题及其解决方案:
安装 pyudt-0.1a 的步骤是:
安装:
libboost-python1.46-dev 或同等版本
(例如,在 linux-ubuntu12.04 中,它位于代表中。)
安装 udt.h (来自: http://sourceforge.net/projects/udt/)进入系统目录,
或者
(将udt.h文件放在与pyudt-0.1a文件相同的路径下,然后将“pyudt.cpp”的一行从:改为
:)
。
使用,
例如:
您必须更正错误,从:更改为
:
因为字符“\0 " 意味着字符串的末尾也必须发送,否则垃圾将被附加到您的字符串中。
或者,您可以选择:
或者:
最后,在相应的文件夹中
:或者,(如果您没有管理员权限为所有用户安装它,而只是想为您尝试一下:)
然后
,代码对于一个简单的客户端可以是:
它可以工作,它与我的 cpp 服务器对话!
注意:如果您需要更多帮助,您可以在 python 的控制台中编写:
PS。使用此安装教程创建的文件是:
/usr/local/lib/python2.7/dist-packages/pyudt.so 和 /usr/local/lib/python2.7/dist-packages/pyudt-0.1a.egg-info
after so many time I've found this question and its solution:
The steps to install pyudt-0.1a are:
install:
libboost-python1.46-dev or equivalent
(for instance, in linux-ubuntu12.04 it's in the reps.)
install udt.h (from: http://sourceforge.net/projects/udt/) into a system directory,
OR
(put the udt.h file in the same path as the pyudt-0.1a files, and then change a line of the "pyudt.cpp", from:
to:
).
using,
eg.:
you must correct a bug, changing from:
to:
because the character "\0" meaning the end of string must also be sent, otherwise junk would be appended to your string.
optionally, you may choose between:
or:
in the corresponding folder:
OR, (if you don't have admin permissions to install it for all the users, and just wanna try it for you:
)
Then, the code for a simple client can be:
and it works, it talks with my cpp server!
notice: if you need more help you can write in the python's console:
PS. the files created with this installation tutorial are:
/usr/local/lib/python2.7/dist-packages/pyudt.so, and /usr/local/lib/python2.7/dist-packages/pyudt-0.1a.egg-info
您可以尝试一下我的udt_py fork。它现在包含一个示例
recvfile.py
,并且可以从 udt 的app
目录中的sendfile
守护进程检索文件。You can give my udt_py fork a try. It includes a sample
recvfile.py
now and can retrieve files from thesendfile
daemon in udt'sapp
directory.