Git Product home page Git Product logo

ex-3's Introduction

IMPLEMENTATION OF SLIDING WINDOW PROTOCOL EXP: 3 DATE:22-03-2023 AIM : To write a python program to perform sliding window protocol ALGORITHM :

  1. Start the program.

  2. Get the frame size from the user

  3. To create the frame based on the user request.

  4. To send frames to server from the client side.

  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
    

SERVER PROGRAM : import socket s=socket.socket() s.connect(('localhost',8000)) while True: print(s.recv(1024).decode()) s.send("acknowledgement recieved from the server".encode())

SERVER OUTPUT :

server2

CLIENT OUTPUT :

2output

RESULT : Thus, python program to perform stop and wait protocol was successfully executed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.