Giter Site home page Giter Site logo

sagir567 / chat_py Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 743 KB

This article demonstrates – How to set up a simple Chat Room server and allow multiple clients to connect to it using a client-side script. The code uses the concept of sockets and threading

Python 100.00%
chat python selective-repeat udp

chat_py's Introduction

Chat_py

Version py 3.9.7

Description:

  • This is an implementation of Selective Repeat reliable transport layer protocol. alt alt

TCP protocol

  • To better understand this, check out the sequence of socket API calls and data flow for TCP:

alt

UDP protocol

  • To better understand this, check out the sequence of socket API calls and data flow for UDP:

alt

Selective Repeat ARQ

  • Selective Repeat ARQ is also known as the Selective Repeat Automatic Repeat Request. It is a data link layer protocol that uses a sliding window method. The Go-back-N ARQ protocol works well if it has fewer errors. But if there is a lot of error in the frame, lots of bandwidth loss in sending the frames again. So, we use the Selective Repeat ARQ protocol. In this protocol, the size of the sender window is always equal to the size of the receiver window. The size of the sliding window is always greater than 1.

  • If the receiver receives a corrupt frame, it does not directly discard it. It sends a negative acknowledgment to the sender. The sender sends that frame again as soon as on the receiving negative acknowledgment. There is no waiting for any time-out to send that frame. The design of the Selective Repeat ARQ protocol is shown below.

alt

  • The example of the Selective Repeat ARQ protocol is shown below in the figure. alt

UML

Running Server with argv:

# Clone the repository
$ git clone https://github.com/bsharabi/Chat_py.git
# Go into the repository
$ cd Chat_py
# Open the terminal on Windows
$ Run "py .\server\Controller.py <host> <port>"
# Open the terminal on Linux
$ Run "python .\server\Controller.py <host> <port>"
# Example
$ Run "py .\server\Controller.py localhost 3000"

Running Server without argv:

It is possible to run in the following way without       arguments and the default value is:
host = localhost
port = 3000
# Example
$ Run "py .\server\Controller.py"

Running Client:

# Clone the repository
$ git clone https://github.com/bsharabi/Chat_py.git
# Go into the repository
$ cd Chat_py
# Open the terminal on Windows
$ Run "py .\client\Controller.py"
# Open the terminal on Linux
$ Run "python .\client\Controller.py"

How To Run App:

# Clone the repository
$ git clone https://github.com/bsharabi/Chat_py.git
# Go into the repository
* first:
  You must first run the server (use the steps above)
-----------------------------------------------------
* Second:
  you need to run the client (use the steps above)
  Note that the choice of host and port is the same between the two parties

chat_py's People

Contributors

bsharabi avatar

Watchers

 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.