IMPLEMENTATION OF SLIDING WINDOW PROTOCOL EXP: 3 DATE:22-03-2023 AIM : To write a python program to perform sliding window protocol ALGORITHM :
5.If your frames reach the server it will send ACK signal to client otherwise it will sendNACK signal to client.
6.Stop the program CLIENT PROGRAM : import socket s=socket.socket() s.bind(('localhost',8000)) s.listen(5) c,addr=s.accept() size=int(input("Enter number of frames to send:")) l=list(range(size)) s=int(input("Enter Window Size:")) st=0 i=0 while
True:
while(i<len(l)):
st+=s
c.send(str(l[i:st]).encode())
ack=c.recv(1024).decode()
if ack:
print(ack)
i+=s