13 #include <nanomsg/nn.h> 14 #include <nanomsg/pipeline.h> 17 #define SOCKET_ADDRESS "inproc://a" 31 push1 = nn_socket(AF_SP, NN_PUSH);
33 pull1 = nn_socket(AF_SP, NN_PULL);
35 pull2 = nn_socket (AF_SP, NN_PULL);
43 int length = strlen(
"ABC");
45 nn_send(push1,
"ABC", length, 0);
47 nn_send(push1,
"DEF", length, 0);
53 bytes = nn_recv(pull1, &buf, NN_MSG, 0);
55 printf (
"PULL1: RECEIVED %s\n", buf);
56 bytes = nn_recv(pull2, &buf, NN_MSG, 0);
58 printf (
"PULL2: RECEIVED %s\n", buf);
66 pull1 = nn_socket (AF_SP, NN_PULL);
68 push1 = nn_socket (AF_SP, NN_PUSH);
70 push2 = nn_socket(AF_SP, NN_PUSH);
73 nn_send (push1,
"ABC", length, 0);
74 nn_send (push2,
"DEF", length, 0);
78 bytes = nn_recv (pull1, &buf, NN_MSG, 0);
80 printf (
"PULL1: RECEIVED %s\n", buf);
81 bytes = nn_recv (pull1, &buf, NN_MSG, 0);
83 printf (
"PULL2: RECEIVED %s\n", buf);