The Client: It should do the following
Points | Task |
5 (1 each) | Correct use of socket, gethostbyname, bind, connect, accept |
2 | Every variable has a comment describing it's use |
-3 | Code indented wrong |
2 | Server makes a socket |
2 | Client connects to the socket |
2 | Server sends a line of text |
2 | That line actually contains the current time |
2 | Client receives and prints the line of text |
3 | Server can accept multiple successive connections |
2 (1 each) | Client or server can accept the port number from the keyboard or the command line |
2 | Turned in by Tuesday 25th at 4:00pm |
-2 | Turned in after Thursday 27th at 4:00pm |
1 | Do correct error checking once |
1 more | Do correct error checking EVERY time it's needed. |
3 | Server offers and client can get either the time or the joke-of-the-day, depending on what the user wants |
2 | Server prints the IP number of the client who's connected. |
Hints: You can get the current time in UNIX format via
time_t ticks = time();
You can convert a UNIX time into a "struct tm" via
struct tm current_tm = localtime(ticks);
You can convert a struct tm into a string via
asctime(current_tm);