Disclaimer:
This example is derived from an example included in the RPC Programming Nutshell text. The code has been slightly modified to run with the new gnu c
compiler and solaris.
There are two programs associated with this simple client-server
example. The server program will look at the directory of the machine
on which the server has been run. The client will ask the server for
a directory and has been hardcoded to look on a specific server
machine by default or will use one of the command line parameters
to determine the name of the server.
1. SERVER is launched to run on a specific machine
In this case that machine is america3: e.g.
{america3:} server &
[2] 2695
{america3:}
2. the CLIENT is run on another machine or the same
machine, supplying the name of a directory to be
retrieved (in this case ~dgame)
{america3:} client ~dgame
...(list of the directory is printed)....
[2] - Exit 1 server
{america3:}
The server in this case terminates after providing
a single service.
OR
{america3:} client ~dgame servermachine
...(list of the directory dgame on servermachine is printed)....
[2] - Exit 1 server
{america3:}
This format allows the client to access a different server
without recompiling the client.
The server function remains the same and terminates after
providing a single service.
3. Double Click the file below to get
a copy of the source needed for compiling the server or client.
NOTE: Be Careful when compiling on other machines. This is set up to run
on Solaris.
The BINARIES are compiled to run server on america3!
If you run the server on another machine, RECOMPILE as stated below!
In order to compile the server:
gcc -lnsl -lsocket -o server server.c readdir.c
In order to compile the client:
gcc -lnsl -lsocket -o client client.c
~dgame/www/sockets
Press SHIFT and Click with your mouse to download a copy.
Filenames are