This assignment requires you to access a service that is only available on a remote computer. Access to this service is by using a remote procedure call. The service is a ``fortune cookie'', that gives you (sometimes) amusing quotes. For example,
If you think education is expensive, try ignorance. -- Derek Bok, president of Harvardor
A long-forgotten loved one will appear soon. Buy the negatives at any price.
The first program must have a local procedure call
char *get_cookie(void)This will just return a string (e.g. "dummy cookie").
The second program should replace this with a remote procedure call
char *get_cookie(void)(see later).
Both programs should read from standard input, and accept the following one-letter commands, one per line:
pandonia.canberra.edu.au
.
The remote call will return a null-terminated string no longer than 1024
bytes (including the '\0' terminator). This should make use of the remote
procedure specification file ~ostutes/rpc/rcookie.x
. Use the
program rpcgen
to generate the client side interface file
rcookie_clnt.c
and the header file rcookie.h
The directory ~ostutes/rpc
also contains a sample
get_cookie
that can run on the server side, and just return
a dummy cookie. You can use this during development where the server is
set to localhost
instead of pandonia
. When this
is working, change the server to pandonia
.
give
.
This command runs with two parameters.
The first parameter should be the assignment name and the second should be the
name of the file containing your C program.
For the first program the assignment name is ``a4stub''. e.g.
give a4stub cookie_stub.cFor the second program the assignment name is ``a4''. e.g.
give a4 cookie_client.c
You may run give
any number of times.
Each time you run give
it replaces any
earlier submission of the assignment.
Submit the C source code for your assignment, not the executable