Ex. No. 4
Ex. No. 4
Date:
Aim:
To install Wire shark, tcpdump and to observe the data transferred in client-server communication
using TCP and UDP.
Procedure:
Before capturing packets, you need a client and a server application that communicate using UDP or TCP. If
you don’t have an existing application, you can use simple tools like:
import socket
print("Server is listening...")
conn, addr = server_socket.accept()
print(f"Connection established with {addr}")
data = conn.recv(1024)
print(f"Received: {data.decode()}")
conn.send(b"Hello from server")
conn.close()
server_socket.close()
response = client_socket.recv(1024)
print(f"Received from server: {response.decode()}")
client_socket.close()
For UDP, modify socket.SOCK_STREAM to socket.SOCK_DGRAM and use sendto()/recvfrom().
UDP filter:
udp.port == 12345
This ensures that we only see relevant packets.
Result:
Thus Wireshark was installed and TCP/UDP communication was captured and observed by applying filters.