Computer Networks Assignments
These assignments are of the course COL334 : Computer Networks offered in First (Diwali) Semester, 2021-22 at IIT Delhi. There are 3 assignments in this repo and all of them are implemented in either C++
or Python
.
Assignment 1
The problem statement of the assignment can be accessed from here.
The assignment consists of three parts-
- Introduction to Networking tools like
ifconfig
,nslookup
,ping
andtraceroute
. - Introduction to packet sniffing using
Wireshark
. - Implementation of
traceroute
usingping
.
Solution
- The results of this assignment are present in the report which can be accessed from here.
- The third part is implemented in
C++
and the plots are generated using aPython
script. These files are present here
Assignment 2
The problem statement of the assignment can be accessed from here.
In this assignment, we build a chat application that allows users to send
plain text messages with one another. Users can direct messages to other users using an @ prefix, and the server needs to forward these messages to the intended recipients. The message could be intended to be sent for a single client (Unicast) or all clients (Broadcast).
This is a simpler version of any commercial chat-based application which make use of centralized servers for relaying the messages, except the fact that messages would be encrypted in the case of commercial applications.
Solution
The assignment is implemented using Python
. There are two files in the src folder - server.py
and client.py
. The first file contains the code for the server end whereas the second file contains the code for the client end.
How to run the code?
-
Run the following command to start the server-
python3 server.py
-
Run the following command to start a client system-
python3 client.py [USERNAME] [SERVER_IP]
Here, USERNAME is the client's username. This username can only contain alphanumeric
[a-zA-Z1-9]
characters.SERVER_IP is the server's IP address for connection. For example-
127.0.0.1
(localhost)
Note
ALL
can't be used as a client's username. It is a reserved keyword for broadcast messages.- Multiple clients can be started using the above mentioned command on same system.
Message format
-
For unicast messages, use
@[RECVR_USERNAME]: Message
Remember RECVR_USERNAME should be a legal username of a client connected to the user. Otherwise, error would be raised by the server side (ERROR 102).
If the format of the message is wrong, appropiate help will be printed. -
For broadcast messages, use
@ALL: Message
Broadcast messages are visible to all the clients connected to the server.
Implementation details
Python
is used to write the code. Python'ssocket
library is used for making TCP sockets.- To handle multiple clients, threads are used to run parallel processes. Python's
threading
library is used for making threads. - At client's end, two threads are used to separate the sending and listening sockets' processes.
- Registration protocol is implemented to register client's sockets at server side.
Assignment 3
The problem statement of the assignment can be accessed from here.
In this assignment, we use the NS-3 simulator, which is a discrete event, packet level network simulator for Internet systems. The assignment consists of three parts-
-
Part 1
In this part, we analyze the different congestion control protocols. The goal is to study how the congestion window at the sender varies with time for different protocols. -
Part 2
In this part, we analyze the effect of the bandwidth/application data rate on the congestion window at the sender. We use the default TcpNewReno as the congestion protocol. -
Part 3
In this part, we learn how to create our own congestion control protocol - TcpNewRenoCSE. In order to understand the behavior of the network using the newly designed congestion control protocol, we will use the topology containing three nodes with two sources and one sink.
Solution
The code to implement the network topology in NS is written in C++
and the script to generate plots is written in Python
.
Part 1
The code for the first part consists of 4 .cc
files which contains the implementation of the following TCP congestion control protocols-
- NewReno
- HighSpeed
- Veno
- Vegas
Congestion Window Size v/s Time plots for the above protocols are generated using the script plotQ1.py
. To execute this part, go to the Part1
directory and run the following command-
sh q1.sh
Part 2
The code for the second part consists of 10 .cc
files which contains the implementation for the following application and channel data rates-
- Application Data Rate: 2 Mbps and Channel Data Rates: 2, 4, 10, 20, 50 Mbps
- Application Data Rates: 0.5, 1, 2, 4, 10 Mbps and Channel Data Rate: 6 Mbps
Congestion Window Size v/s Time plots for the above data rates are generated using the script plotQ2.py
. To execute this part, go to the Part2
directory and run the following command-
sh q2.sh
Part 3
The code for the third part consists of the new congestion control protocol TcpNewRenoCSE
header and code files present in the Congestion folder.
There are also 3 .cc
files which contains the implementation for the following configurations of the network topology-
- Configuration1: All senders use TcpNewReno.
- Configuration2: Connection3 at TCP source uses the new congestion protocol TcpNewRenoCSE. The remaining senders use the default protocol TcpNewReno.
- Configuration3: All senders use TcpNewRenoCSE.
For all three configurations above, the following hold:
- Application data rate: 1.5 Mbps
- Connection 1 starts at time 1sec, Connection 2 starts at time 5sec, Connection 3 starts at time 15sec.
- Connection 1 ends at time 20sec, Connection 2 ends at time 25sec, Connection 3 ends at time 30sec.
- Packet size is 3000 bytes.
Congestion Window Size v/s Time plots for the above configurations are generated using the script plotQ3.py
. To execute this part, go to the Part3
directory and run the following command-
sh q3.sh
The plots for the all the parts and the number of packets dropped for each network topology is present in the report.
Author
- Name : Gaurav Jain
- Entry Number : 2019CS10349