wangzhengquan
2021-02-20 b5ae34d4422399c5d5458d071cca8c9bc89d20bb
test_net_socket/test_net_mod_socket.cpp
@@ -527,102 +527,6 @@
}
int main(int argc, char *argv[]) {
   shm_mm_wrapper_init(512);
  argument_t opt = parse_args(argc, argv);
 // port = atoi(argv[2]);
  if(opt.fun == NULL) {
    usage(argv[0]);
    exit(1);
  }
   if (strcmp("start_net_proxy", opt.fun) == 0 ) {
    if(opt.port == 0) {
      usage(argv[0]);
      exit(1);
    }
    start_net_proxy(opt);
  }
  else if (strcmp("start_bus_server", opt.fun) == 0) {
    start_bus_server(opt);
  }
  else if (strcmp("start_reply", opt.fun) == 0) {
    if(opt.key == 0) {
      usage(argv[0]);
      exit(1);
    }
    start_reply(opt.key);
  }
  else if (strcmp("start_net_client", opt.fun) == 0) {
    if(opt.sendlist == 0) {
      fprintf(stderr, "Missing sendlist .\n");
      usage(argv[0]);
      exit(1);
    }
    if(opt.publist == 0) {
      fprintf(stderr, "Missing publist.\n");
      usage(argv[0]);
      exit(1);
    }
    start_net_client(opt.sendlist, opt.publist);
  }
  else if (strcmp("one_sendto_many", opt.fun) == 0) {
    if(opt.sendlist == 0) {
      fprintf(stderr, "Missing sendlist .\n");
      usage(argv[0]);
      exit(1);
    }
    one_sendto_many(opt.sendlist);
  }
  else if (strcmp("test_net_sendandrecv", opt.fun) == 0) {
    if(opt.sendlist == 0) {
      fprintf(stderr, "Missing sendlist .\n");
      usage(argv[0]);
      exit(1);
    }
    test_net_sendandrecv(opt.sendlist);
  }
  else if (strcmp("test_net_pub_threads", opt.fun) == 0) {
    if(opt.publist == 0) {
      fprintf(stderr, "Missing publist .\n");
      usage(argv[0]);
      exit(1);
    }
    test_net_pub_threads(opt.publist);
  }
  else if (strcmp("test_net_pub", opt.fun) == 0) {
    if(opt.publist == 0) {
      fprintf(stderr, "Missing publist .\n");
      usage(argv[0]);
      exit(1);
    }
    test_net_pub(opt.publist);
  }
  else if (strcmp("start_resycle", opt.fun) == 0) {
    start_resycle();
  }
  else {
    usage(argv[0]);
    exit(1);
  }
  printf("==========end========\n");
  // shm_mm_wrapper_destroy();
}
void usage(char *name)
{
@@ -799,3 +703,101 @@
  }
  printf("============node list end==========\n");
}
int main(int argc, char *argv[]) {
  shm_mm_wrapper_init(512);
  argument_t opt = parse_args(argc, argv);
 // port = atoi(argv[2]);
  if(opt.fun == NULL) {
    usage(argv[0]);
    exit(1);
  }
  if (strcmp("start_net_proxy", opt.fun) == 0 ) {
    if(opt.port == 0) {
      usage(argv[0]);
      exit(1);
    }
    start_net_proxy(opt);
  }
  else if (strcmp("start_bus_server", opt.fun) == 0) {
    start_bus_server(opt);
  }
  else if (strcmp("start_reply", opt.fun) == 0) {
    if(opt.key == 0) {
      usage(argv[0]);
      exit(1);
    }
    start_reply(opt.key);
  }
  else if (strcmp("start_net_client", opt.fun) == 0) {
    if(opt.sendlist == 0) {
      fprintf(stderr, "Missing sendlist .\n");
      usage(argv[0]);
      exit(1);
    }
    if(opt.publist == 0) {
      fprintf(stderr, "Missing publist.\n");
      usage(argv[0]);
      exit(1);
    }
    start_net_client(opt.sendlist, opt.publist);
  }
  else if (strcmp("one_sendto_many", opt.fun) == 0) {
    if(opt.sendlist == 0) {
      fprintf(stderr, "Missing sendlist .\n");
      usage(argv[0]);
      exit(1);
    }
    one_sendto_many(opt.sendlist);
  }
  else if (strcmp("test_net_sendandrecv", opt.fun) == 0) {
    if(opt.sendlist == 0) {
      fprintf(stderr, "Missing sendlist .\n");
      usage(argv[0]);
      exit(1);
    }
    test_net_sendandrecv(opt.sendlist);
  }
  else if (strcmp("test_net_pub_threads", opt.fun) == 0) {
    if(opt.publist == 0) {
      fprintf(stderr, "Missing publist .\n");
      usage(argv[0]);
      exit(1);
    }
    test_net_pub_threads(opt.publist);
  }
  else if (strcmp("test_net_pub", opt.fun) == 0) {
    if(opt.publist == 0) {
      fprintf(stderr, "Missing publist .\n");
      usage(argv[0]);
      exit(1);
    }
    test_net_pub(opt.publist);
  }
  else if (strcmp("start_resycle", opt.fun) == 0) {
    start_resycle();
  }
  else {
    usage(argv[0]);
    exit(1);
  }
  printf("==========end========\n");
  // shm_mm_wrapper_destroy();
}