Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Python library for nanomsg.

Project description


Python library for nanomsg 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.

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.


from __future__ import print_function
from nanomsg import Socket, PAIR, PUB
s1 = Socket(PAIR)
s2 = Socket(PAIR)
s1.send(b'hello nanomsg')

Or if you don't mind nesting you can use Socket as a context manager

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.

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)




Tony Simpson

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for motorcortex-nanomsg, version 1.1.7
Filename, size File type Python version Upload date Hashes
Filename, size motorcortex_nanomsg-1.1.7-cp37-cp37m-win32.whl (89.5 kB) File type Wheel Python version cp37 Upload date Hashes View hashes
Filename, size motorcortex_nanomsg-1.1.7-cp37-cp37m-win_amd64.whl (114.7 kB) File type Wheel Python version cp37 Upload date Hashes View hashes
Filename, size motorcortex-nanomsg-1.1.7.tar.gz (12.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page