//****************************************// //*** Main Function ***// //****************************************// int main(int argn, char *argc[]) { //Server parameter is : argc[1] : Server Program Number // others arguments depend on server program int run_mode = 0; int progNum = atoi(argc[1]); //char *simplePing_proc(); bool_t rslt; //char nettype[16] = "visible"; SVCXPRT *transp; struct netconfig *nconf; if ((nconf = getnetconfigent("udp")) == NULL) { fprintf(stderr, "Cannot get netconfig entry for UDP\n"); exit(1); } transp = svc_tp_create(exm_proc, progNum, VERSNUM, nconf); if (transp == NULL) { fprintf(stderr, "Cannot create service.\n"); exit(1); } svc_run(); fprintf(stderr, "svc_run() returned. ERROR has occurred.\n"); svc_unreg(progNum, VERSNUM); return 1; }
//****************************************// //*** Main Function ***// //****************************************// int main(int argn, char *argc[]) { //Server parameter is : argc[1] : Server Program Number // others arguments depend on server program int progNum = atoi(argc[1]); SVCXPRT *transp = NULL; struct netconfig *nconf; //Initialization svc_unreg(progNum, VERSNUM); if ((nconf = getnetconfigent("udp")) == NULL) { fprintf(stderr, "Cannot get netconfig entry for UDP\n"); exit(1); } transp = svc_tp_create(exm_proc, progNum, VERSNUM, nconf); if (transp == NULL) { fprintf(stderr, "Cannot create service.\n"); exit(1); } if (!svc_reg(transp, progNum, VERSNUM, exm_proc, nconf)) { fprintf(stderr, "svc_reg failed!!\n"); exit(1); } svc_run(); fprintf(stderr, "svc_run() returned. ERROR has occurred.\n"); svc_unreg(progNum, VERSNUM); return 1; }
//****************************************// //*** Main Function ***// //****************************************// int main(int argn, char *argc[]) { int progNum = atoi(argc[1]); SVCXPRT *transp; struct netconfig *nconf; if ((nconf = getnetconfigent("udp")) == NULL) { fprintf(stderr, "Cannot get netconfig entry for UDP\n"); exit(1); } transp = svc_tp_create(exm_proc, progNum, VERSNUM, nconf); if (transp == NULL) { fprintf(stderr, "Cannot create service.\n"); exit(1); } svc_run(); fprintf(stderr, "svc_run() returned. ERROR has occurred.\n"); svc_unreg(progNum, VERSNUM); return 1; }
int main(int argn, char *argc[]) { //Program parameters : argc[1] : HostName or Host IP // argc[2] : Server Program Number // other arguments depend on test case //run_mode can switch into stand alone program or program launch by shell script //1 : stand alone, debug mode, more screen information //0 : launch by shell script as test case, only one printf -> result status int run_mode = 0; int test_status = 1; //Default test result set to FAILED int progNum = atoi(argc[2]); char nettype[16] = "visible"; SVCXPRT *svcr; struct netconfig *nconf; //Test initialization if ((nconf = getnetconfigent("tcp")) == (struct netconfig *)NULL){ fprintf(stderr, "Cannot get netconfig entry for TCP\n"); exit(1); } if (run_mode == 1) { printf("Server : %s\n", argc[1]); printf("Server # %d\n", progNum); } //First create server svcr = svc_tp_create(exm_proc, progNum, VERSNUM, nconf); //Prepare destruction svc_unreg(progNum, VERSNUM); //then destroy it svc_destroy(svcr); svc_unreg(progNum, VERSNUM); //If we are here, test has passed test_status = 0; //This last printf gives the result status to the tests suite //normally should be 0: test has passed or 1: test has failed printf("%d\n", test_status); return test_status; }