ZIO
Python and C++ interface to ZeroMQ and Zyre
|
A port holds a socket in the context of a node. More...
#include <port.hpp>
Public Types | |
typedef std::string | address_t |
typedef std::string | nodename_t |
typedef std::string | portname_t |
Public Member Functions | |
Port (const std::string &name, int stype, const std::string &hostname="127.0.0.1") | |
Create a port of given name and socket type. More... | |
~Port () | |
void | set_origin (origin_t origin) |
Access the owning node's origin. More... | |
void | set_verbose (bool verbose=true) |
const std::string & | name () const |
Access this port's name. More... | |
void | bind () |
Request a default bind. More... | |
void | bind (const std::string &hostname, int tcpportnum) |
Request a bind to a specific TCP/IP host and port. More... | |
void | bind (const address_t &address) |
Request bind to fully qualified ZeroMQ address string. More... | |
void | connect (const address_t &address) |
Request connect to fully qualified ZeroMQ address string. More... | |
void | connect (const nodename_t &node, const portname_t &port) |
Request connect to abstract node/port names. More... | |
void | subscribe (const std::string &prefix="") |
Subscribe to a PUB topic. More... | |
void | set_header (const std::string &leafname, const std::string &value) |
Set an extra port header. More... | |
headerset_t | do_binds () |
Perform any requested binds. More... | |
void | online (Peer &peer) |
Make any previously requested connections. More... | |
void | offline () |
Disconnect and unbind. More... | |
void | send (Message &msg) |
Send a message. More... | |
bool | recv (Message &msg, int timeout=-1) |
Recieve a message, return false if timeout occurred. More... | |
zio::socket_t & | socket () |
Access the underlying cppzmq socket. More... | |
A port holds a socket in the context of a node.
A port provides an identity (name) for the socket in the context of a node to the network (via a peer) and to the application (via a method).
It provides direct and discovery-based bind() and connect().
Finally, using its send() and recv() their messages will adhere to the ZIO conventions.
typedef std::string zio::Port::address_t |
typedef std::string zio::Port::nodename_t |
typedef std::string zio::Port::portname_t |
zio::Port::Port | ( | const std::string & | name, |
int | stype, | ||
const std::string & | hostname = "127.0.0.1" |
||
) |
void zio::Port::bind | ( | ) |
void zio::Port::bind | ( | const std::string & | hostname, |
int | tcpportnum | ||
) |
void zio::Port::bind | ( | const address_t & | address | ) |
void zio::Port::connect | ( | const address_t & | address | ) |
void zio::Port::connect | ( | const nodename_t & | node, |
const portname_t & | port | ||
) |
zio::headerset_t zio::Port::do_binds | ( | ) |
|
inline |
void zio::Port::offline | ( | ) |
void zio::Port::online | ( | zio::Peer & | peer | ) |
bool zio::Port::recv | ( | Message & | msg, |
int | timeout = -1 |
||
) |
void zio::Port::send | ( | zio::Message & | msg | ) |
Send a message.
The zio::Message is modified to set its coordinates.
void zio::Port::set_header | ( | const std::string & | leafname, |
const std::string & | value | ||
) |
|
inline |
|
inline |
void zio::Port::subscribe | ( | const std::string & | prefix = "" | ) |