Skip to content

Latest commit

 

History

History

Assignment 3

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Assignment 3: TCP/UDP Client-Server Implementation using Socket Programming

Deadline: 15

th November 2022, 11:59PM (Considering Meraz-22)

Extended Deadline: 18

th November 2022, 11:59PM


Goal of the Assignment: Get familiar with socket programming and learn to create your own client server applications using socket programming.

Part 1: Client/Server Programming to transfer content of a file [20 Points] Create your own TCP/UDP client and server application to transfer content of a file. The client should request for the content of a file by providing the file name and server should send the contents of that file to the client. For simplicity, assume that the file is a simple text file that contains a set of words, with first word being your name and the last word being “EOF” (end-of-file). The server should look for the file in the local directory, if the file is not there it should send back a message “404: File-not-Found”. After receiving this message, the client should print an error message “File not found” and exit. If the file is present, the server should read the first line of the file, which contains your name, and send this message to the client. After receiving your name, the client creates a local file (with a different file name from the requested one) and sends a message Word_#1 to the server. This message indicates that the client is requesting the first word. After receiving the message Word_#1, the server sends the first word after your name to the client. The client writes this word to the local file after receiving it and sends the message Word_#2 to request the next word and so on. This process continues until the

client receives the keyword EOF. Once the client receives the keyword EOF, it closes the local file after writing the last word to the file. Part 2: Client/Server Programming for network analysis [30 Points]

  1. (15 Points) Create your own UDP echo client and server application to measure round trip time between client and server (similar to “ping” command). The client should create a UDP socket and send echo packets to server at a given interval, number of echo messages, and given packet size (use command line arguments). For simplicity you can keep buffer size same as packet size. On reception of the packet, server should send the packet back to the client. The client on reception of the packet should calculate and display the round-trip time. To calculate the round-trip time, you can have the timestamp in the packet or/and use some unique identifier in the packet. You should also calculate and print the loss percentage at the end.
  2. (15 Points) Create an iperf like application using the above developed echo client and server program. Reduce the interval between two consecutive UDP echo packets generated by client to increase the number of echo packets sent from client for a given packet size. Calculate the throughput and average delay observed every one second. Plot the observed throughput and average delay vs time (1 second interval). Part 3: Making Echo Client/Server “protocol Independent” [15 Points] Revise echo client and server to be protocol independent (support both IPv4 and IPv6). Hint 1: sockaddr is too small for sockaddr_in6. sockaddr_storage has enough

size to support both sockaddr_in and sockaddr_in6. (You will see this in server- side program.)

Hint 2: integrate getaddrinfo to avoid typing IPv6 address on your CLI

Hint 3: you may use hostname (IPv4: “localhost”, IPv6: “ip6-localhost” address to develop / demonstrate the software on ubuntu. They’re written in “/etc/hosts”. Part 4: Create your own client server application [15 Points] Add any one feature to Client/Server and demonstrate them. In the report, you must describe the new features with their benefit. Significance of the feature will impact the marks given.

Instructions for Implementation: ● You may choose any programing language (C, JAVA, Python, etc.) ● The software must be based on Socket Programming. ● Wrappers of API must not be used (messaging etc). Use send/recv or read/write using TCP/UDP socket. ● Keep the record of Reference. Deliverables in a tar ball on GC:

  1. A report detailing your implementation detail and the results. The core idea of your answer to each question. Better visibility like screenshot of application will be appreciated. One single report file (.pdf for all three parts, include the code in the report as well.
  2. Screenshots of packet capture using Wireshark during your experiments.
  3. Screenshots showing the working of your code.
  4. All source codes and README as a separate file so that TAs and instructor can compile source code and execute the binary anytime.
  5. Submit all files in a single zip file named as ,.zip Note: Plagiarism check will be done on your submitted code/report. This assignment will be evaluated through presentation. In the presentation, you are expected to explain and demonstrate the applications you built.