The _zmq_proxy_steerable()_ function is a variant of the _zmq_proxy()_ function.
It accepts a fourth _control_ socket. When the _control_ socket is _NULL_ the
two functions operate identically.
When a _control_ socket of type _REP_ is provided to the proxy function the
application may send commands to the proxy. The following commands are
supported.
_PAUSE_::
The proxy will cease transferring messages between its endpoints.
_RESUME_::
The proxy will resume transferring messages between its endpoints.
_TERMINATE_::
The proxy function will exit with a return value of 0.
_STATISTICS_::
The proxy behavior will remain unchanged and reply with a set of simple summary values of the messages that have been sent through the proxy as described next.
There are eight statistics values, each of size _uint64_t_ in the multi-part
message reply to the _STATISTICS_ command. These are:
- number of messages received by the frontend socket
- number of bytes received by the frontend socket
- number of messages sent by the frontend socket
- number of bytes sent by the frontend socket
- number of messages received by the backend socket
- number of bytes received by the backend socket
- number of messages sent by the backend socket
- number of bytes sent by the backend socket
RETURN VALUE
------------
The _zmq_proxy_steerable()_ function returns 0 if TERMINATE is received on its
control socket. Otherwise, it returns -1 and errno set to ETERM or EINTR (the
0MQ context associated with either of the specified sockets was terminated) or
EFAULT (the provided frontend or backend was invalid).
EXAMPLE
-------
.Create a function to run the proxy
----
// Create the frontend and backend sockets to be proxied