wni.nano

Submodules

wni.nano.poll

Polling for nanomsg sockets

class wni.nano.poll.RxPoll(sockets)[source]

Bases: object

Wrapse select.poll() to provide a convenient interface for nanomsg sockets.

Note

Any nanomsg sockets registered with this poll object will have their recv_timeout set to 0, so that polling will be fast (the poll function call already blocks, so blocking on recv doesn’t make any sense.)

poll(timeout=-1)[source]

Returns a list of (socket, recv_data) tuples for all sockets that had receive data ready.

register(socket)[source]

Register a nanomsg socket for polling.

unregister(socket)[source]

Remove a nanomsg socket from the poll.

wni.nano.util

Utility functions for working with nanomsg.

wni.nano.util.subscribe(socket, topic)[source]
wni.nano.util.unsubscribe(socket, topic)[source]
wni.nano.util.Subscriber(addr, topic, method='connect')[source]

Returns a nanomsg.Socket that is connected to addr and subscribed to topic. method can be either “connect”, “bind”, or None

wni.nano.util.get_current_connections(socket)[source]

Return the number of accepted connections on the socket. Not implemented on Windows.

Module contents