DUE MONDAY FEB 16th. -10% per workday after!!!
Your goal is to write a client and a server.
Server: Make a socket Wait for a connection Open a file Until error or end-of-file read from socket write to file Client Make a connection to the server Until error or end-of-file read from file write to connection
You get one point for every item above. This assignment is out of 10 points. If you can also send the filename from the client to the server, that's an extra credit point. You lose one point for every day after Mon Feb 11th.
If I were doing this assignment I would
Start with your server from the last assignment.
Add open-a-file
Add read from the file and write to the socket
Get a copy of your client from the last assignment.
Edit it such that it just copies from the socket to the screen.
Test this combination. You should see the file from the server on the client's screen.
Add a client side read/write loop, copying the data from socket to file
Test
Celebrate
Checklist for the program
Run the server with no arguments. It should not crash.
Run the server with port 80. It cannot have port 80 unless you are root. It should warn and exit.
Run the client without starting the server first. It should notice it did not connect to the server.
Run the client with no arguments. It should not crash.
Run the client with a misspelled hostname. It should notice that it did not connect.
Run the client with the wrong port number. It should notice that it did not connect.
If you can set the filename, set the filename to "/". You don't have permission to write to that. It should warn or something.
While the client and server are connected, kill the server. The client should notice but not crash but maybe exit.