1 /* @(#)rprintmsg.c 2.1 88/08/11 4.0 RPCSRC */
3 * rprintmsg.c: remote version of "printmsg.c"
6 #include <rpc/rpc.h> /* always need this */
7 #include "msg.h" /* need this too: will be generated by rpcgen*/
19 fprintf(stderr, "usage: %s host message\n", argv[0]);
24 * Remember what our command line arguments refer to
30 * Create client "handle" used for calling MESSAGEPROG on the
31 * server designated on the command line. We tell the rpc package
32 * to use the "tcp" protocol when contacting the server.
34 cl = clnt_create(server, MESSAGEPROG, MESSAGEVERS, "tcp");
37 * Couldn't establish connection with server.
38 * Print error message and die.
40 clnt_pcreateerror(server);
45 * Call the remote procedure "printmessage" on the server
47 result = printmessage_1(&message, cl);
50 * An error occurred while calling the server.
51 * Print error message and die.
53 clnt_perror(cl, server);
58 * Okay, we successfully called the remote procedure.
62 * Server was unable to print our message.
63 * Print error message and die.
65 fprintf(stderr, "%s: sorry, %s couldn't print your message\n",
71 * The message got printed on the server's console
73 printf("Message delivered to %s!\n", server);