Skip to content

Commit

Permalink
CN
Browse files Browse the repository at this point in the history
  • Loading branch information
Amey-Thakur committed Jul 30, 2021
1 parent edced33 commit d5549be
Show file tree
Hide file tree
Showing 12 changed files with 105 additions and 0 deletions.
Binary file added CISCO/AMEY_B-50_CN_EXAM_HYBRID_TOPOLOGY.pkt
Binary file not shown.
Binary file added CISCO/CN_FTP.pkt
Binary file not shown.
Binary file added CISCO/CN_LAN.pkt
Binary file not shown.
Binary file added CISCO/CN_OSPF.pkt
Binary file not shown.
Binary file added CISCO/CN_RING.pkt
Binary file not shown.
Binary file added CISCO/CN_STAR.pkt
Binary file not shown.
Binary file added CISCO/CN_TREE.pkt
Binary file not shown.
79 changes: 79 additions & 0 deletions CISCO/CRC.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@

# Returns XOR of 'a' and 'b'
# (both of same length)
def xor(a, b):

# initialize result
result = []

# Traverse all bits, if bits are
# same, then XOR is 0, else 1
for i in range(1, len(b)):
if a[i] == b[i]:
result.append('0')
else:
result.append('1')

return ''.join(result)


# Performs Modulo-2 division
def mod2div(divident, divisor):

# Number of bits to be XORed at a time.
pick = len(divisor)

# Slicing the divident to appropriate
# length for particular step
tmp = divident[0 : pick]

while pick < len(divident):

if tmp[0] == '1':

# replace the divident by the result
# of XOR and pull 1 bit down
tmp = xor(divisor, tmp) + divident[pick]

else: # If leftmost bit is '0'
# If the leftmost bit of the dividend (or the
# part used in each step) is 0, the step cannot
# use the regular divisor; we need to use an
# all-0s divisor.
tmp = xor('0'*pick, tmp) + divident[pick]

# increment pick to move further
pick += 1

# For the last n bits, we have to carry it out
# normally as increased value of pick will cause
# Index Out of Bounds.
if tmp[0] == '1':
tmp = xor(divisor, tmp)
else:
tmp = xor('0'*pick, tmp)

checkword = tmp
return checkword

# Function used at the sender side to encode
# data by appending remainder of modular division
# at the end of data.
def encodeData(data, key):

l_key = len(key)

# Appends n-1 zeroes at end of data
appended_data = data + '0'*(l_key-1)
remainder = mod2div(appended_data, key)

# Append remainder in the original data
codeword = data + remainder
print("Remainder : ", remainder)
print("Encoded Data (Data + Remainder) : ",
codeword)

# Driver code
data = "10110010"
key = "101"
encodeData(data, key)
9 changes: 9 additions & 0 deletions CISCO/Socket Programming/client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import socket

c = socket.socket()

c.connect(('localhost',9999))
name = input("Enter your Name:")
c.send(bytes(name,'utf-8'))

print(c.recv(1024).decode())
Expand Down
17 changes: 17 additions & 0 deletions CISCO/Socket Programming/server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import socket

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

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

s.listen(3)
print('Waiting for the connection')

while True:
c , addr = s.accept()

name = c.recv(1024).decode()
print('Connected with : ', addr , name)
c.send(bytes('Thankyou','utf-8'))
c.close()
Expand Down
Binary file added Practical Exam/Amey_B-50_CN_Practical_Exam.pdf
Binary file not shown.
Binary file not shown.

0 comments on commit d5549be

Please sign in to comment.