/* * This is sample code generated by rpcgen. * These are only templates and you can use them * as a guideline for developing your own functions. */ #include "suma.h" void suma_prg_1(char *host) { CLIENT *clnt; int *result_1; sumandos suma_1_arg; #ifndef DEBUG clnt = clnt_create (host, SUMA_PRG, SUMA_VER, "udp"); if (clnt == NULL) { clnt_pcreateerror (host); exit (1); } #endif /* DEBUG */ suma_1_arg.sumando1 = 1; /* Codigo aņadido por programador */ suma_1_arg.sumando2 = 2; /* Codigo aņadido por programador */ result_1 = suma_1(&suma_1_arg, clnt); if (result_1 == (int *) NULL) { clnt_perror (clnt, "call failed"); } printf ("La suma de %d + %d es %d\n", suma_1_arg.sumando1, suma_1_arg.sumando2, *result_1); /* Codigo aņadido por programador */ #ifndef DEBUG clnt_destroy (clnt); #endif /* DEBUG */ } int main (int argc, char *argv[]) { char *host; if (argc < 2) { printf ("usage: %s server_host\n", argv[0]); exit (1); } host = argv[1]; suma_prg_1 (host); exit (0); }