You are on page 1of 1

Hng dn lp trnh RPC

Son tho file avg.x to cu trc chng trnh v kiu d liu truyn RPC. Ni
dung file nh km.
Chy chng trnh rpcgen to cc stubs. Tham s -a to mi file cn thit.
Sau vit hm hin thc tnh trung bnh cc s thc trn file avg_server.c
[globus@gridnode01]$ rpcgen -a avg.x
Chy chng trnh server ng k vi dch v portmap:
[globus@gridnode01]$ ./avg_server &
[1] 17486
[globus@gridnode01]$ rpcinfo -p localhost
program vers proto port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
100024 1 udp 32768 status
100024 1 tcp 32768 status
391002 2 tcp 32769 sgi_fam
22855 1 udp 32771
22855 1 tcp 32782
Chy chng trnh client gi hm t xa:
[globus@gridnode01]$ ./avg_client localhost $RANDOM $RANDOM $RANDOM
value = 2.209800e+04
value = 1.104200e+04
value = 2.739500e+04
average = 2.017833e+04