nanomsg-python
==============
Python library for [nanomsg](http://nanomsg.org/) which does not compromise on
usability or performance.
Like nanomsg this library is still experimental, the API is fairly stable but
if you plan to use it at this time be prepared to get your hands dirty,
fixes and enhancements are very welcome.
The following versions of Python are supported CPython 2.6+, 3.2+ and Pypy 2.1.0+
Bugs and change requests can be made
[here](https://github.com/tonysimpson/nanomsg-python/issues).
nanommsg library in /usr/local
==============================
If you're nanomsg is in /usr/local and your machine is not configured to find it there you can rename the usr_local_setup.cfg to setup.cfg to fix the problem.
Example
=======
```python
from __future__ import print_function
from nanomsg import Socket, PAIR, PUB
s1 = Socket(PAIR)
s2 = Socket(PAIR)
s1.bind('inproc://bob')
s2.connect('inproc://bob')
s1.send(b'hello nanomsg')
print(s2.recv())
s1.close()
s2.close()
```
Or if you don't mind nesting you can use Socket as a context manager
```python
with Socket(PUB) as pub_socket:
.... do something with pub_socket
# socket is closed
```
The lower level API is also available if you need the additional control or
performance, but it is harder to use. Error checking left out for brevity.
```python
from nanomsg import wrapper as nn_wrapper
from nanomsg import PAIR, AF_SP
s1 = nn_wrapper.nn_socket(AF_SP, PAIR)
s2 = nn_wrapper.nn_socket(AF_SP, PAIR)
nn_wrapper.nn_bind(s1, 'inproc://bob')
nn_wrapper.nn_connect(s2, 'inproc://bob')
nn_wrapper.nn_send(s1, b'hello nanomsg', 0)
result, buffer = nn_wrapper.nn_recv(s2, 0)
print(bytes(buffer))
nn_wrapper.nn_term()
```
License
=======
MIT
Authors
=======
[Tony Simpson](https://github.com/tonysimpson)
没有合适的资源?快使用搜索试试~ 我知道了~
nanomsg-python 是 nanomsg 的 Python 语言实现版本.rar
共25个文件
py:14个
yml:2个
gitignore:1个
需积分: 5 0 下载量 50 浏览量
2023-06-21
06:16:40
上传
评论
收藏 27KB RAR 举报
温馨提示
如何生成适合的 C 库等。不过还有另一种情况:通过将 Python 嵌入 C/C++ 应用以扩展程序的功能。 Python 嵌入实现了一些使用 Python 更合适的功能。这可以有很多用途,一个例子是允许用户裁减需要的 Python 功能。也可以用于默写使用 Python 编写更加方便的功能。 嵌入 Python 与扩展很像。扩展 Python 时,主程序是 Python 解释器,但是嵌入 Python 则主程序并不是 Python 的 - 是程序的其他部分调用 Python 来实现一些功能。 所以,如果要嵌入 Python,你可以提供自己的主程序,这个主程序需要初始化 Python 解释器。至少需要调用函数 Py_Initialize () (对于 MacOS,调用 PyMac_Initialize ())。可以选择是否传入命令行参数到 Python。然后你就可以在应用的任何地方调用 Python 解释器了。 用
资源推荐
资源详情
资源评论
收起资源包目录
nanomsg-python 是 nanomsg 的 Python 语言实现版本.rar (25个子文件)
nanomsg-python 是 nanomsg 的 Python 语言实现版本
anomsg-python-master
nanomsg
__init__.py 13KB
version.py 21B
wrapper.py 207B
.travis.yml 694B
build.cmd 838B
setup.py 3KB
test_utils
throughput.py 2KB
soaktest.py 1008B
LICENSE 1KB
_nanomsg_cpy
wrapper.c 15KB
tests
__init__.py 0B
test_poll.py 2KB
test_pair.py 1KB
test_pubsub.py 995B
test_general_socket_methods.py 1KB
usr_local_setup.cfg 94B
nanomsg_wrappers
__init__.py 1004B
docs
index.rst 355B
Makefile 7KB
conf.py 8KB
.gitignore 303B
_nanomsg_ctypes
__init__.py 9KB
appveyor.yml 3KB
README.md 2KB
新建文本文档.txt 19B
共 25 条
- 1
资源评论
野生的狒狒
- 粉丝: 2353
- 资源: 2099
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 7777端口抓包数据集
- IMG_0694.GIF
- 基于图像的三维模型重建C++源代码+文档说明(高分课程设计)
- 基于聚焦法的工件立体测量方案,根据数据进行三维重建 使用HALCON处理图像,MATLAB拟合数据+源代码+数据集+效果图
- 锄战三国村 修改:货币使用不减 v1.10(2) 原创 (中文).apk
- 基于python实现的单目双目视觉三维重建+源代码+图像图片(高分课程设计)
- 基于C+++OPENCV的全景图像拼接源码(课程设计)
- 基于Python+OpenCV对多张图片进行全景图像拼接,消除鬼影,消除裂缝+源代码+文档说明+界面截图(高分课程设计)
- 基于C++实现的全景图像拼接源码(课程设计)
- 基于SIFT特征点提取和RASIC算法实现全景图像拼接python源码+文档说明+界面截图+详细注释(95分以上课程大作业)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功