Code Monkey home page Code Monkey logo

ex-3's Introduction

EX-3 IMPLEMENTATION OF SLIDING WINDOW PROTOCOL

DATE : 23.03.2023

AIM :

To write a python program to perform sliding window protocol

ALGORITHM :

STEP1 : Start the program.

STEP2 : Get the frame size from the user

STEP3 : To create the frame based on the user request.

STEP4 : To send frames to server from the client side.

STEP5 : If your frames reach the server it will send ACK signal to client otherwise it will send NACKsignal to client.

STEP6 : Stop the program.

CLIENT PROGRAM :

Developed : Malarvizhi G

Reg no : 212222040096

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 recived from the server".encode())

OUTPUT :

SERVER OUTPUT :

ex03 server output

CLIENT OUTPUT :

ex03 client output

RESULT :

Thus, python program to perform stop and wait protocol And Sliding Window Protocol was successfully executed.

ex-3's People

Contributors

sujathamohankumar avatar 22008650 avatar

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.