60 lines
3.0 KiB
Plaintext
60 lines
3.0 KiB
Plaintext
This directory contains several examples of networking code. These examples
|
|
also serve as programs to test the correctness and performance of the
|
|
networking and to provide some useful utility functions. In all the tests,
|
|
the client and server may run on the same machine, or if an Ethernet is
|
|
installed, on different machines. The ports 'xyz' used in tests 1 and 2
|
|
are examples. It is possible to run multiple tests at the same time (e.g.,
|
|
n1 sets of (client1, server1) and n2 sets of (client2, server2), provided
|
|
that each pair of (clientX, serverX) uses a port not used by any other process.
|
|
|
|
1. Test 1 consists of two programs, server1.c and client1.c. This test
|
|
transfers 1 megabyte from the client to the server in 1K chunks, has the
|
|
server transform the data and send it back. The client then verifies if
|
|
the returned data is correct. To run the test, type the following lines:
|
|
|
|
make client1 server1
|
|
server1 xyz &
|
|
client1 xyz
|
|
|
|
If an Ethernet is installed and the kernel has been compiled with
|
|
-DAM_KERNEL, the server and client may either be on the same machine or
|
|
one different ones. If there is no Ethernet and the kernel has been
|
|
compiled with _DAM_KERNEL -DNONET, both processes must be on the same CPU.
|
|
|
|
At the end of the test, "ok" is printed if no errors occurred. Otherwise
|
|
the number of bad transactions is printed. Both the client and server exit
|
|
by themselves after the test has been completed.
|
|
|
|
2. Test 2 consists of two programs, server2.c and client2.c. This test
|
|
measures the performance of the transactions. Like test 1, it can be run
|
|
either locally or remotely. The test consists of having the client request
|
|
n bytes of data from the server, where n grows from 1 to 30,000 bytes per
|
|
transaction. For each value of n, the test is run 1000 times to increase
|
|
the statistical accuracy. For each value of n, the value of n, the delay
|
|
(transaction time in milliseconds), and the throughput (bytes/sec moved)
|
|
is reported. To run the test, type:
|
|
|
|
make client2 server2
|
|
server2 xyz &
|
|
client2 xyz
|
|
|
|
|
|
3. Test 3 is an example of how one might go about making a remote file server
|
|
for MINIX to service diskless PCs. In this approach, one writes a server,
|
|
server3.c in this example, and a set of library routines, contained in
|
|
client3.c. These library routines should have the same names as the MINIX
|
|
system calls, such as open(), read(), and write(). When programs are linked
|
|
with these routines instead of the usual ones, the routines make calls to
|
|
the remote file server instead of FS. The file client3.c contains not only
|
|
a few of these library routines, but also a short main program to test them.
|
|
The main program fetches a file from the remote file server and copies it to
|
|
stdout. To test the program, type:
|
|
|
|
make client3 server3
|
|
server3 &
|
|
client3 <filename>
|
|
|
|
where <filename> is the name of a file on the same machine as server3. The
|
|
result of this command will be that <filename> is written to client3's
|
|
standard output.
|