├── CPT 1.jpg ├── CPT 2(a).jpg ├── CPT 2(b).jpg ├── CPT 3(a).jpg ├── CPT 3(b).jpg ├── CPT 4(a).jpg ├── CPT 4(b).jpg ├── CPT 5(a).jpg ├── Checksum.py ├── Dijkstra's algorithm.py ├── Hub vs Switch.pkt ├── PoE.pkt ├── README.md ├── Routers.pkt ├── Serverudp.py ├── Subnetting.py └── TCPIT.pkt /CPT 1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dheeraj-02NK/Computer-Network-Lab/d1e36569143c4f85fc34efd2a86524a5a925a7b2/CPT 1.jpg -------------------------------------------------------------------------------- /CPT 2(a).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dheeraj-02NK/Computer-Network-Lab/d1e36569143c4f85fc34efd2a86524a5a925a7b2/CPT 2(a).jpg -------------------------------------------------------------------------------- /CPT 2(b).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dheeraj-02NK/Computer-Network-Lab/d1e36569143c4f85fc34efd2a86524a5a925a7b2/CPT 2(b).jpg -------------------------------------------------------------------------------- /CPT 3(a).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dheeraj-02NK/Computer-Network-Lab/d1e36569143c4f85fc34efd2a86524a5a925a7b2/CPT 3(a).jpg -------------------------------------------------------------------------------- /CPT 3(b).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dheeraj-02NK/Computer-Network-Lab/d1e36569143c4f85fc34efd2a86524a5a925a7b2/CPT 3(b).jpg -------------------------------------------------------------------------------- /CPT 4(a).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dheeraj-02NK/Computer-Network-Lab/d1e36569143c4f85fc34efd2a86524a5a925a7b2/CPT 4(a).jpg -------------------------------------------------------------------------------- /CPT 4(b).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dheeraj-02NK/Computer-Network-Lab/d1e36569143c4f85fc34efd2a86524a5a925a7b2/CPT 4(b).jpg -------------------------------------------------------------------------------- /CPT 5(a).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dheeraj-02NK/Computer-Network-Lab/d1e36569143c4f85fc34efd2a86524a5a925a7b2/CPT 5(a).jpg -------------------------------------------------------------------------------- /Checksum.py: -------------------------------------------------------------------------------- 1 | def sender(n,datagram): 2 | print('\n\n\n-----Sender End-----') 3 | checksum = 0 4 | for i in range(1,n): 5 | checksum = checksum + datagram[i] 6 | print('Checksum at sender End is',checksum) 7 | return checksum 8 | 9 | def receiver(n,datagram,check): 10 | print('-----Receiver End-----') 11 | for i in range(1,n): 12 | check = check - datagram[i] 13 | if check != 0: 14 | print('The packet is collided') 15 | return False 16 | else: 17 | print('Checksum at receiver end is',check) 18 | return check 19 | 20 | datagram = [] 21 | n = int(input("Enter number of packets: ")) 22 | print('Enter:') 23 | for i in range(1,n+1): 24 | p = int(input('Packet: ')) 25 | datagram.append(p) 26 | 27 | check = sender(n,datagram) 28 | print('\n\n\nPacket sending......\n\n\n') 29 | res = receiver(n,datagram,check) 30 | if res == 0: 31 | print('\n\n\nCommunication is Successful!!!') 32 | -------------------------------------------------------------------------------- /Dijkstra's algorithm.py: -------------------------------------------------------------------------------- 1 | import heapq # heapq is used to implement priority queues 2 | 3 | def dijkstra(graph, start): 4 | # initialize all distances to infinity 5 | distances = {node: float('inf') for node in graph} 6 | # set the distance to the start node to 0 7 | distances[start] = 0 8 | # initialize the priority queue with the start node and its distance 9 | pq = [(0, start)] 10 | 11 | # loop while there are still nodes to visit 12 | while pq: 13 | # pop the node with the smallest distance from the priority queue 14 | (dist, node) = heapq.heappop(pq) 15 | # if the distance to the node is already known, skip it 16 | if dist > distances[node]: 17 | continue 18 | # loop over the node's neighbors 19 | for neighbor, weight in graph[node].items(): 20 | # calculate the distance to the neighbor through the current node 21 | distance = dist + weight 22 | # if this distance is shorter than the previously known distance, update it 23 | if distance < distances[neighbor]: 24 | distances[neighbor] = distance 25 | # add the neighbor to the priority queue with its new distance 26 | heapq.heappush(pq, (distance, neighbor)) 27 | 28 | # return the dictionary of shortest distances from the start node to each node 29 | return distances 30 | 31 | graph = { 32 | 'A': {'B': 3, 'C': 1}, 33 | 'B': {'C': 7, 'D': 5}, 34 | 'C': {'D': 2, 'E': 7}, 35 | 'D': {'E': 1}, 36 | 'E': {} 37 | } 38 | 39 | distances = dijkstra(graph, 'A') 40 | print(distances) 41 | -------------------------------------------------------------------------------- /Hub vs Switch.pkt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dheeraj-02NK/Computer-Network-Lab/d1e36569143c4f85fc34efd2a86524a5a925a7b2/Hub vs Switch.pkt -------------------------------------------------------------------------------- /PoE.pkt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dheeraj-02NK/Computer-Network-Lab/d1e36569143c4f85fc34efd2a86524a5a925a7b2/PoE.pkt -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Computer-Network-Lab 2 | 3 | Computer communication and Networking Laboratory in Cisco Packet Tracer 4 | -------------------------------------------------------------------------------- /Routers.pkt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dheeraj-02NK/Computer-Network-Lab/d1e36569143c4f85fc34efd2a86524a5a925a7b2/Routers.pkt -------------------------------------------------------------------------------- /Serverudp.py: -------------------------------------------------------------------------------- 1 | from socket import * 2 | serverPort = 12000 3 | serverSocket = socket(AF_INET, SOCK_DGRAM) 4 | serverSocket.bind(("127.0.0.1", serverPort)) 5 | print("The server is ready to receive") 6 | while 1: 7 | sentence, clientAddress = serverSocket.recvfrom(2048) 8 | file = open(sentence, "r") 9 | l = file.read(2048) 10 | serverSocket.sendto(bytes(l, "utf-8"), clientAddress) 11 | print("Sent back to client: ", l) 12 | file.close() 13 | -------------------------------------------------------------------------------- /Subnetting.py: -------------------------------------------------------------------------------- 1 | def Int2Bin(integer): 2 | binary = '.'.join([bin(int(x)+256)[3:] for x in integer.split('.')]) 3 | return binary 4 | 5 | IP = input('Enter an IP address: ') 6 | Subnet = input('Enter the Subnet mask: ') 7 | IP_binary = Int2Bin(IP) 8 | Subnet_binary = Int2Bin(Subnet) 9 | 10 | print('\nIP:', IP, "->", IP_binary) 11 | print('Subnet:', Subnet, "->", Subnet_binary) 12 | 13 | # Wild Card 14 | def complement(number): 15 | if number == '0': 16 | number = '1' 17 | elif number == '.': 18 | pass 19 | else: 20 | number = '0' 21 | return number 22 | 23 | def find_wildcard(binary_subnet): 24 | binary_list = list(binary_subnet) 25 | wildcard = ''.join(complement(binary_list[y]) for y in range(len(binary_list))) 26 | return wildcard 27 | 28 | def convert_decimal(wildcard_Binary): 29 | binary = {} 30 | for x in range(4): 31 | binary[x] = int(wildcard_Binary.split(".")[x], 2) 32 | dec = ".".join(str(binary[x]) for x in range(4)) 33 | return dec 34 | 35 | wildcard_binary = find_wildcard(Int2Bin(Subnet)) 36 | WildCard = convert_decimal(wildcard_binary) 37 | print('Wildcard:', WildCard, '->', wildcard_binary) 38 | 39 | # Network ID 40 | def andOP(IP1, IP2): 41 | ID_list = {} 42 | for y in range(4): 43 | ID_list[y] = int(IP1.split(".")[y]) & int(IP2.split(".")[y]) 44 | ID = ".".join(str(ID_list[z]) for z in range(4)) 45 | return ID 46 | 47 | networkID = andOP(IP, Subnet) 48 | network_Binary = Int2Bin(networkID) 49 | print('Network ID:', networkID, "->", network_Binary) 50 | 51 | # Broadcast IP 52 | def orOP(IP1, IP2): 53 | Broadcast_list = {} 54 | for z in range(4): 55 | Broadcast_list[z] = int(IP1.split(".")[z]) | int(IP2.split(".")[z]) 56 | broadcast = ".".join(str(Broadcast_list[c]) for c in range(4)) 57 | return broadcast 58 | 59 | broadcastIP = orOP(networkID, WildCard) 60 | broadcastIP_binary = Int2Bin(broadcastIP) 61 | print('Broadcast IP:', broadcastIP, "->", broadcastIP_binary) 62 | 63 | # Max IP 64 | def maxiIP(brdcstIP): 65 | maxIPs = brdcstIP.split(".") 66 | if int(brdcstIP.split(".")[3]) - 1 == 0: 67 | if int(brdcstIP.split(".")[2]) - 1 == 0: 68 | if int(brdcstIP.split(".")[1]) - 1 == 0: 69 | maxIPs[0] = int(brdcstIP.split(".")[0]) - 1 70 | else: 71 | maxIPs[1] = int(brdcstIP.split(".")[1]) - 1 72 | else: 73 | maxIPs[2] = int(brdcstIP.split(".")[2]) - 1 74 | else: 75 | maxIPs[3] = int(brdcstIP.split(".")[3]) - 1 76 | return ".".join(str(maxIPs[x]) for x in range(4)) 77 | 78 | maxIP = maxiIP(broadcastIP) 79 | maxIP_binary = Int2Bin(maxIP) 80 | print('Max. IP:', maxIP, "->", maxIP_binary) 81 | 82 | # Min IP 83 | def miniIP(ntwrkID): 84 | miniIPs = ntwrkID.split(".") 85 | if int(ntwrkID.split(".")[3]) + 1 == 256: 86 | if int(ntwrkID.split(".")[2]) + 1 == 256: 87 | if int(ntwrkID.split(".")[1]) + 1 == 256: 88 | miniIPs[0] = int(ntwrkID.split(".")[0]) + 1 89 | miniIPs[1] = 0 90 | miniIPs[2] = 0 91 | miniIPs[3] = 0 92 | else: 93 | miniIPs[1] = int(ntwrkID.split(".")[1]) + 1 94 | miniIPs[2] = 0 95 | miniIPs[3] = 0 96 | else: 97 | miniIPs[2] = int(ntwrkID.split(".")[2]) + 1 98 | miniIPs[3] = 0 99 | else: 100 | miniIPs[3] = int(ntwrkID.split(".")[3]) + 1 101 | return ".".join(str(miniIPs[x]) for x in range(4)) 102 | 103 | minIP = miniIP(networkID) 104 | minIP_binary = Int2Bin(networkID) 105 | print('Min. IP:', minIP, "->", minIP_binary) 106 | -------------------------------------------------------------------------------- /TCPIT.pkt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dheeraj-02NK/Computer-Network-Lab/d1e36569143c4f85fc34efd2a86524a5a925a7b2/TCPIT.pkt --------------------------------------------------------------------------------