Handed Out: 12 October 1999
Due: 28 October 1999 online by 5pm
-p < port > | port the server listens on |
-t < encoding > | encoding type (optional), possible values are NRZ (default) or NRZI |
-d < debug > | debugging string (optional), possible values are details, status, and fatal (default) |
-f < file > | file to send |
-h < host > | host name of the server |
-p < port > | port the server listens on |
-t < encoding > | encoding type (optional), possible values are NRZ (default) or NRZI |
-d < debug > | debugging string (optional), possible values are details, status, and fatal (default) |
/cs/classes/cis510networks/program1
Together, these will form a framework for this assignment.
The files are:
Makefile | Has the information needed to compile the programs. You should first type
make depend to create dependencies (be sure mkdep has execute
permission). This will allow you to recompile only the necessary modules
when you change a file. To compile the programs, type make. To remove
any object files, type make clean.
You must use the Makefile to compile your program and you must use the executable names of server and client. You may modify the Makefile to add additional files required for your executables, but you should otherwise not change its format. |
server.cc | Implements a sample server. You should modify this so that it does argument parsing and then creates one end of a TCP connection and waits for the client to connect and form the "link". Once the link is created, the server receives a file from the server and then closes the connection. The file is transfered with one of the encodings listed above. |
client.cc | Implements the client. You should modify this so that it does the argument parsing and then connects to the server to form a "link." The client sends a file to the server and then closes the connection. The file is transfered with one of the encodings listed above. |
test.cc | A place for you to implement a test program. |
tcp_socket.h/.cc | Defines the TCP socket interface. You can use this interface to create a client and server TCP socket, then send and receive data over this socket. The data transfer over the socket is reliable, so you do not need to worry about error or loss. |
debug.h/.cc | Functions that help you to print debugging comments. |
Read the comments in the files for more details.
The server knows the file transfer is done when it tries to read data and it gets 0 bytes back from the socket interface.
You should first write a test program that just reads in a string, encodes it, then immediately decodes it. This way you can be sure you are manipulating bits correctly without bothering with the TCP interface. Once you do this, then you should get the client and server communicating, and then check for interoperability with the solution code.
When you are testing your program, it will be very helpful to print each bit as you read it in, then again when you encode it, then again when you decode it. This will allow you to check whether your encoding is working as it should.
You can run both the client and the server on the same machine.