#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <netinet/in.h>  /* For htonl and ntohl */
#include <unistd.h>

#include <nanomsg/nn.h>
#include <nanomsg/reqrep.h>

#define  NN_URL   "ipc:///tmp/pbcon.ipc"

int main(int argc, char **argv)
{
   int sock = nn_socket(AF_SP, NN_REQ);
   int   rv = nn_connect(sock, NN_URL);
   char *buf = NULL;

   printf("sending mode power \n");
   printf("sent %d bytes request\n", nn_send(sock, "mode power", strlen("mode power"), 0)); //NN_DONTWAIT));
   printf("recv %d bytes reply\n", nn_recv(sock, &buf, NN_MSG, 0)); //  NN_DONTWAIT));
   printf("recv %s\n", buf);
   //nn_freemsg(buf);

   return 0;
}
