Required Tasks:
In this part of the assignment, a server implementation, in C using WinSock API (Application Program Interface), is provided. For MacOS Users – please use the alternative, explained in the labs! Please note that MacOS does not support WinSock API and Putty. You are required to test out its functionality using a Telnet client, understand how the program works, then carry out the required tasks, according to the specifications listed below:
Task 0:
• If you don’t have a standard C compiler, you can install MinGW (or any equivalent environment, to use the gcc compiler or equivalent).
• Test the provided server:
Download, compile and run Server.c in one command window.
In a separate window, use Putty (or an equivalent Telnet client) to connect to the server program.
Observe the execution.
Explore the code and understand how it relates to the flowcharts from the lecture.
Task 1:
• Modify the original server code so that it accepts any port number instead of the predefined one (i.e., port number 8989). Port number will be entered in the command line when testing the Server1.exe
Task 2:
• Improve the server code (from Server1.c) to handle multiple requests (instead of one) from the same Putty (or equivalent Telnet client) session. For each new connection, the server window should display:
a. the IP address of the client,
b. the port number targeted by the client’s request.
For each message received, the server should display the length of the message.
Task 3:
Instead of using Putty, develop a client program to read characters from the console (input by the user). If the characters “exit client” are read, the client should terminate. Otherwise send the inputs to the server. The server response should be displayed in the client window.
{SUBMISSION: The developed client should be saved as EchoClient.c}
Task 4:
Modify the server code (from Server2.c) to handle specific COMMANDS sent from the client. A particular command, in this task, is “date”. Typing “date” in the Client, which will be sent to the Server, the server should respond with the Current Date and Time with a format of “dd-mm-yy hh” − This should be presented on a single line, that is terminated with a carriage return (ASCII code 13) and line feed (ASCII code 10). − e.g., of output: 30-11-21 09 • If any other characters (i.e., not command), the server will handle them as in tasks 1 and 2.
{SUBMISSION: The modified server should be saved as Server3.c}
Task 5:
Modify the server code (from Server3.c) to accept additional options for the command “date” sent from the client. Particularly, different date format should be accepted as the following table: Command Expected Format Example date “dd-mm-yy hh” 30-11-21 09 date1 “yyyy” 2021
date2 “hh” 09 date3 “dd-Mon-yy” 30-Nov-21
{SUBMISSION: The modified server should be saved as Server4.c}
FINAL SUBMISSION INSTRUCTIONS
1. You are required to submit ALL the required tasks, as per the assignment instructions above (see the “Submission” line under each task).
2. Adherence to the files’ naming rule (i.e., Server1.c ≠ server1.c and EchoClient.c ≠ Echoclient.c). Changing on letter of submitted file may cause you to get “0” on the corresponding task.
3. Your comments, within the code files, will serve as your brief reporting on the task.
4. Remember to complete your details, on the “Marking Sheet”, and submit the file as well.
5. We reserve the right to ask all/any students to explain their submitted work at any time. Failure to explain it properly could affect your mark.
6. All students must submit on Moodle a ZIP file containing all the required files.
It should include all the required files (as indicated under each task) + the marking sheet (with your detailed typed in)
Task 1: Server1
- Accept any port number as an option for running the server 5 - Implement the command “exit server” 8 - Outputs in uppercase 8
Task 2: Server2
- Multiple requests handling 11
- Display of IP address 8 - Display the port number 8 - Display the message length 8
Task 3: EchoClient
- Client code, meeting specifications (as in the brief), successfully compile & run. 14
- Implement the command “exit client” 8
Task 4: Server3
- Server3, handling the "date" command (as in the brief), successfully compile & run. 11
Task 5: Server4
- Server4, handling the extra options for the "date" command (and its parameters, as per the brief), successfully compile & run.