Samstag, 12. Februar 2011

CS6223 Distributed Systems -- Code Samples

CS6223 Distributed Systems -- Code Samples

http://www.cs.cityu.edu.hk/~jia/C/
/*
* 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 "msg.h"
#include
#include /* getenv, exit */


void
msgprog_1(host)
char *host;
{
CLIENT *clnt;
int *result_1;
char * savemsg_1_arg;
char * *result_2;
int readmsg_1_arg;

#ifndef DEBUG
clnt = clnt_create(host, MSGPROG, MSGVER, "netpath");
if (clnt == (CLIENT *) NULL) {
clnt_pcreateerror(host);
exit(1);
}
#endif /* DEBUG */

savemsg_1_arg = "This's an example of RPC. Save this message.";
result_1 = savemsg_1(&savemsg_1_arg, clnt);
if (result_1 == (int *) NULL) {
clnt_perror(clnt, "call failed");
}
printf("return result: %d\n", *result_1);


#ifndef DEBUG
clnt_destroy(clnt);
#endif /* DEBUG */
}


main(argc, argv)
int argc;
char *argv[];
{
char *host;

if (argc < 2) {
printf("usage: %s server_host\n", argv[0]);
exit(1);
}
host = argv[1];
msgprog_1(host);
}



Keine Kommentare: