Question
Modify the average RPC programs (avg.x, avg_proc.c and ravg.c) so that it computes the standard deviation of a maximum of 100 numbers instead of the
Modify the average RPC programs (avg.x, avg_proc.c and ravg.c) so that it computes the standard deviation of a maximum of 100 numbers instead of the average of a maximum of 200 numbers. Test your program on the server. The average RPC program is available on Canvas - a Makefile is included). Just type make (make sure you have an .rhost file under your home directory, and that 'white' space works correctly in the makefile (i.e., cut and paste the makefile will not work).
For the avg program: Run the RPC server program by starting the server: ./avg_svc For the avg program: Run the RPC client program by: ./ravg 127.0.0.1 1 2 3 4 Try to use a different 'port number' than other classmates by changing the 22855 number given in the avg.x file. Suggestion, use the last 4 digits of your student ID number or some other unique number. Deliverable: A zip or tar file with the full directory of files implementing this logic.
RPC Makefile
CC = gcc BIN = ravg avg_svc GEN = avg_clnt.c avg_svc.c avg_xdr.c avg.h RPCCOM = rpcgen
all: $(BIN)
ravg: ravg.o avg_clnt.o avg_xdr.o $(CC) -o $@ ravg.o avg_clnt.o avg_xdr.o -lnsl
ravg.o: ravg.c avg.h $(CC) -g ravg.c -c
avg_svc: avg_proc.o avg_svc.o avg_xdr.o $(CC) -o $@ avg_proc.o avg_svc.o avg_xdr.o -lnsl
avg_proc.o: avg_proc.c avg.h $(CC) -g avg_proc.c -c
$(GEN): avg.x $(RPCCOM) avg.x
clean cleanup: rm -f $(GEN) *.o $(BIN)
avg.x
/* * The average procedure receives an array of real
* numbers and returns the average of their
* values. This toy service handles a maximum of
* 200 numbers.
* http://www.linuxjournal.com/article/2204?page=0,1
*/ const MAXAVGSIZE = 200;
struct input_data
{
double input_data<200>;
};
typedef struct input_data input_data;
program AVERAGEPROG {
version AVERAGEVERS {
double AVERAGE(input_data) = 1;
} = 1;
} = 22855;
rhost
127.0.0.1 pghosh
Makefile
CC = gcc BIN = ravg avg_svc GEN = avg_clnt.c avg_svc.c avg_xdr.c avg.h RPCCOM = rpcgen CPATH = $CPATH:/usr/include/tirpc
all: $(BIN)
ravg: ravg.o avg_clnt.o avg_xdr.o $(CC) -o $@ ravg.o avg_clnt.o avg_xdr.o -lnsl -ltirpc
ravg.o: ravg.c avg.h $(CC) -g ravg.c -c
avg_svc: avg_proc.o avg_svc.o avg_xdr.o $(CC) -o $@ avg_proc.o avg_svc.o avg_xdr.o -lnsl -ltirpc
avg_proc.o: avg_proc.c avg.h $(CC) -g avg_proc.c -c
$(GEN): avg.x $(RPCCOM) avg.x
clean cleanup: rm -f $(GEN) *.o $(BIN)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started