You are on page 1of 8

NAME: Ananya Dikshit REG. NO.

: 20BRS1016
FACULTY: Mr. Seshu Babu Pulagra
LAB SLOT: L37-L38

CSE1004
Communications and Networks
FAT LAB
Part -1: Cisco Packet Tracer

AIM: To implement the given network using Cisco Packet Tracer.

PROGRAMMING SOFTWARE: Cisco Packet Tracer

ALGORITHM:

 Place the end devices, i.e. the PCs, on the workspace.


 Connect them respectively to the switches.
 Assign some IP Addresses to the PCs. And form the network using correct
wires.
 Ping all the devices to check if the network works correctly.
 We consider Laptop0 as the source and Laptop10 as the Destination.
 Finally, send a packet from the Source PC to the Destination PCs. And
simulate the network.

NETWORK DIAGRAM:
CONFIGURATIONS:
OBSERVATIONS:
CONCLUSION: We are successful in creating the given network using Cisco Packet
Tracer Software.
PART-2: Programming

Aim: To code for basic server-client system where the client enters a domain
name, server sends the IP Address of the domain name. (using TCP/IP
protocol)

Programming Language: Python


Algorithm:
Server:
 Create a Socket.
 Bind the IP Address and the Port Number of the machine.
 Listen for any connections. The number specified in the bracket is the number
of connections the server can hold at a time.
 Accept the connection from the client.
 Send and Receive data from the client.
 Close the Socket created.

Client:
 Create a Socket.
 Connect with the server by sending a request.
 Send and Receive data from the server.
 Close the Socket created.
CODE FOR THE SERVER:
import socket

s = socket.socket()
print("Socket Created")

s.bind(('localhost',9999))

s.listen(1)
print("Listening...")

while True:
c,addr = s.accept()
domain_name = c.recv(1024).decode()
ipaddr=socket.gethostbyname(domain_name)
print("Connected with", addr)
c.send(bytes(ipaddr,'utf-8'))

c.close()

CODE FOR THE CLIENT:


import socket

c = socket.socket()

c.connect(('localhost',9999))

domain_name = input("Enter domain


name ")
c.send(bytes(domain_name,'utf-8'))
print(c.recv(1024).decode())
c.close()
EXPECTED OUTPUT: The server needs to show the IP Address and the Port
Number of the connected client. While the Client needs to print the IP Address sent
by the Server for the input Domain Name.

OUTPUT FOR THE SERVER:

OUTPUT FOR THE CLIENT:

CONCLUSION: We are successful in creating a socket programming where the


client sends a domain name and the server returns back the IP Address of the
domain name using Python programming language.

You might also like