-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhello_client.c
More file actions
42 lines (33 loc) · 954 Bytes
/
hello_client.c
File metadata and controls
42 lines (33 loc) · 954 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
The CLIENT program: hello_client.c
Modified to remove filler argument
*/
#include <stdio.h>
#include <stdlib.h>
#include "hello.h" /* generated by rpcgen and then modified */
int
main(int argc, char *argv[])
{
CLIENT *client;
int *return_value;
char *server;
if (argc != 2) {
fprintf(stderr, "Usage: %s host_name\n", argv[0]);
exit(1);
}
server = argv[1];
/* Create RPC client handle */
client = clnt_create(server, DISPLAY_PRG, DISPLAY_VER, "tcp");
if (client == NULL) {
clnt_pcreateerror(server);
exit(2);
}
printf("client : Calling function.\n");
/* Call remote function WITHOUT filler argument */
return_value = print_hello_1(client);
if (return_value && *return_value)
printf("client : Mission accomplished.\n");
else
printf("client : Unable to display message.\n");
return 0;
}