|
def | __init__ (self, name, sock, hostname='127.0.0.1') |
|
def | __str__ (self) |
|
def | bind (self, spec) |
|
def | connect (self, spec) |
|
def | subscribe (self, prefix="") |
|
def | add_headers (self, args, kwargs) |
|
def | do_binds (self) |
|
def | online (self, peer=None) |
|
def | offline (self) |
|
def | send (self, msg) |
|
def | recv (self, timeout=None) |
|
Definition at line 52 of file port.py.
◆ __init__()
def zio.port.Port.__init__ |
( |
|
self, |
|
|
|
name, |
|
|
|
sock, |
|
|
|
hostname = '127.0.0.1' |
|
) |
| |
Create a Port with a name and a ZeroMQ socket type.
Ports are typically not meant to be constructed directly by
application code but instead through a managing zio.Node
Definition at line 53 of file port.py.
◆ __str__()
def zio.port.Port.__str__ |
( |
|
self | ) |
|
◆ add_headers()
def zio.port.Port.add_headers |
( |
|
self, |
|
|
|
args, |
|
|
|
kwargs |
|
) |
| |
Add one or more headers or dictionaries of headers.
Every key will be wrapped into ZIO port header convention.
The headers will appear to the network as
zio.port.<portname>.<key> = <value>
The self.headers collects these.
Definition at line 123 of file port.py.
◆ bind()
def zio.port.Port.bind |
( |
|
self, |
|
|
|
spec |
|
) |
| |
Request a bind.
If spec is None, do a default/ephemeral bind.
If spec is a string, it is assumed to be a ZeroMQ adddress.
If spec is a tuple ithen it is a (hostname,portnumber).
Definition at line 83 of file port.py.
◆ connect()
def zio.port.Port.connect |
( |
|
self, |
|
|
|
spec |
|
) |
| |
Request a connect.
If a single string is given it is a ZeroMQ address.
If two strings are given they are (nodename, portname).
Definition at line 100 of file port.py.
◆ do_binds()
def zio.port.Port.do_binds |
( |
|
self | ) |
|
Actually perform binds.
Return dictionary suitable for use as peer headers the give
information about the binds.
This must be called prior to any call of .online() and is
intended to be used by a zio.Node which holds this zio.Port.
Definition at line 140 of file port.py.
◆ offline()
def zio.port.Port.offline |
( |
|
self | ) |
|
Bring this port offline.
This unbinds and disconnects and forgets their addresses
Definition at line 204 of file port.py.
◆ online()
def zio.port.Port.online |
( |
|
self, |
|
|
|
peer = None |
|
) |
| |
Bring this port online.
If no peer is given then indirect connects will fail.
This method is intended for use by a zio.Node which holds this
zio.Port.
Definition at line 164 of file port.py.
◆ recv()
def zio.port.Port.recv |
( |
|
self, |
|
|
|
timeout = None |
|
) |
| |
Receive and return a zio.Message waiting up to a timeout
If timeout is reached then None is returned.
Definition at line 239 of file port.py.
◆ send()
def zio.port.Port.send |
( |
|
self, |
|
|
|
msg |
|
) |
| |
Send a zio.Message
This modifies the message prior to sending to set the origin
if this port has one.
Definition at line 219 of file port.py.
◆ subscribe()
def zio.port.Port.subscribe |
( |
|
self, |
|
|
|
prefix = "" |
|
) |
| |
Subscribe to a PUB/SUB topic.
This method is only meaningful if our socket is a SUB and then
it MUST be called if messages are expected to be received.
Definition at line 111 of file port.py.
◆ bound
◆ connected
◆ ctx
◆ headers
◆ is_online
◆ name
◆ origin
◆ poller
◆ sock
◆ to_bind
◆ to_conn
The documentation for this class was generated from the following file: