#include <nanomsg/nn.h>
#include <nanomsg/reqrep.h>
This protocol is used to distribute the workload among multiple stateless workers.
Please note that request/reply applications should be stateless.
It's important to include all the information necessary to process the request in the request itself, including information about the sender or the originator of the request if this is necessary to respond to the request.
Sender information cannot be retrieved from the underlying socket connection since, firstly, transports like IPC may not have a firm notion of a message origin. Secondly, transports that have some notion may not have a reliable one --- a TCP disconnect may mean a new sender, or it may mean a temporary loss in network connectivity.
For this reason, sender information must be included by the application if required. Allocating 6 randomly-generated bytes in the message for the lifetime of the connection is sufficient for most purposes. For longer-lived applications, an UUID is more suitable.
NN_REQ
NN_REP
NN_REQ_RESEND_IVL
nn_bus(7) nn_pubsub(7) nn_pipeline(7) nn_survey(7) nn_pair(7) nanomsg(7)