#include "ccs.h"
#include <stdio.h>

static void  usage(void)
{
  fprintf(stderr, "Usage: client svrIP svrPort\n");
  exit(1);
}

main(int argc, char **argv)
{
  CcsServer svr;
  int i;
  char *sendWhat="milind";
  char reply[1024];
  if(argc < 3) {
    usage();
  }
  if(argc>3)
	   sendWhat=argv[3];
  
  CcsConnect(&svr, argv[1], atoi(argv[2]));
  for(i=0;i<CcsNumPes(&svr);i++) {
    CcsSendRequest(&svr, "ping", i, strlen(sendWhat)+1, sendWhat);
    CcsRecvResponse(&svr, 1023, reply,60);
    printf("Reply: %s", reply);
  }

  for(i=0;i<CcsNumPes(&svr);i++) {
    CcsSendRequest(&svr, "ping", i, strlen(sendWhat)+1, sendWhat);
    CcsRecvResponse(&svr, 1023, reply,60);
    printf("Reply: %s", reply);
  }
  exit(0);
}

