Computer Network Roshan Jacob
Computer Network Roshan Jacob
Computer Network
Roshan Jacob
U2101162
32
ECE-Gamma
The captured packets include traffic from multiple protocols but I have filtered 3 from them:
1. HTTP
2. DNS
24-10-2024
3. TCP
4. Analysis
24-10-2024
Q2. Analyse how TCP packets handle packet loss , congestion and retransmission
1. TCP Packets
2. TCP Retransmission
3. Duplicate Acknowledgement
4. Retransmission Timeout
24-10-2024
import socket
import threading
# Server setup
host = '127.0.0.1' # Localhost (can be changed to your IP for a different network)
port = 55555
# List of clients
clients = []
nicknames = []
client.send("NICK".encode('utf-8'))
nickname = client.recv(1024).decode('utf-8')
nicknames.append(nickname)
clients.append(client)
print("Server is listening...")
receive()
import socket
import threading
# Choose a nickname
nickname = input("Choose your nickname: ")
if message == 'NICK':
client_socket.send(nickname.encode('utf-8'))
else:
print(message)
except:
# Close connection if there is an error
print("An error occurred!")
client_socket.close()
break
send_thread = threading.Thread(target=send_messages)
send_thread.start()