Skip to content

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

Notifications You must be signed in to change notification settings

sagir567/Chat_py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages