You are on page 1of 10

MULTITHREADED CHAT APpLICATION

IN PYTHON

Project presented under “Project Based Learning”

By

[1] TANAYA THAKUR (Roll No :- 43)

[2] SHRADDHA TAMHANE (Roll No :- 39)

Class

SE

Department of Information technology


Pillai HOC College of Engineering & Technology
2019-2020
CERTIFICATE

This is to certify that the project entitled MULTITHREADED CHAT


APPLICATION IN PYTHON is a bonafide work of Tanaya Thakur
and Shraddha Tamhane studying in SE which is carried under
“Project Based Learning”.

Head of Department PBL Coordinators

Dr. J.E.Nalavade Ms. Poonam Pathak


Project Report Approval

This project report entitled MULTITHREADED CHAT


APPLICATION IN PYTHON by Tanaya Thakur and Shraddha
Tamhane studying in SE is been approved which is carried under
“Project Based Learning”.

Guide Name

Ms. Rupali Sathe

Date : 24/04/2020

Declaration
I declare that this written submission represents my ideas in my own words and
where others’ ideas or words have been included, I have adequately cited them and
referenced the original sources. I also declare that I have adhered to the principles
of academic honesty and integrity and have not misrepresented or fabricated or
falsified any idea/data/fact/source in my submission. I understand that any
violation of the above will be cause for disciplinary action by the institute and an
also evoke penal action from the sources which have thus not been properly cited
or from whom proper permission has not been taken when needed.

TABLE OF CONTENTS
Title

1. Introduction

2. Multithreading

3. Sockets

4. Server

5. Client

6. Output

7. Advantages and Disadvantages

Introduction
To attain a chat model which can perform many processes Or tasks at
same time with very low halting problem i.e. a Multi – Threaded Client
Server Chat Model. A thread is sub process that runs a set of commands
individually of any other thread. So, every time a user connects to the
server, a separate thread is created for that user and communication from
server to client takes place along individual threads based on socket
objects created for the sake of identity of each client. We will require
two scripts to establish this chat room. One to keep the serving running,
and another that every client should run in order to connect to the server.

Sockets can be thought of as endpoints in a communication channel that


is bi-directional, and establishes communication between a server and
one or more clients. Here, we set up a socket on each end and allow a
client to interact with other clients via the server. The socket on the
server side associates itself with some hardware port on the server side.
Any client that has a socket associated with the same port can
communicate with the server socket.

SERVER
A server is either a program, a computer, or a device that is devoted to
managing network resources.
Servers can either be on the same device or computer or locally
connected to other devices.
There are various types of servers such as database servers, network
servers, print servers, etc.
Servers commonly make use of methods like socket.socket(),
socket.bind(), socket.listen(), etc to establish a connection and bind to
the clients.

CLIENT
A client is either a computer or software that receives information or
services from the server.
In a client-server module, clients requests for services from servers.
The best example is a web browser such as Google Chrome, Firefox, etc.
These web browsers request web servers for the required web pages and
services as directed by the user.
Other examples include online games, online chats, etc.

ADVANTAGES
Centralized system with all data in a single place.
The capacity of client and servers can be changed separately.
Cost efficient requires less maintenance cost and Data recovery is
possible.

DISADVANTAGES
Client are prone to viruses if present in the server or uploaded into the
server.
Server are prone to Denial of service(DOS) attacks.
Data Packets may be modified during transmission.

Multi-threading Modules
A _thread module & threading module is used for multi-threading in python,
these modules help in synchronization and provide a lock to a thread in
use.
from_thread import*
import threading

A lock object is created by->


print_lock = threading.Lock()
A lock has two states, “locked” or “unlocked”. It has two basic methods
acquire() and release(). When the state is unlocked print_lock.acquire() is
used to change state to locked and print_lock.release() is used to change
state to unlock.
The function thread.start_new_thread() is used to start a new thread and
return its identifier. The first argument is the function to call and its second
argument is a tuple containing the positional list of arguments.
Acknowledgement

It is a privilege for us to have been associated with Ms. Rupali Sathe, our guide,
during this project work. We have been greatly benefited by his valuable
suggestions and ideas. It is with great pleasure that we express our deep sense of
gratitude to them for their valuable guidance, constant encouragement and patience
throughout this work.

I am also indebted to Dr. J.E.Nalavade (Head of Department of IT Engineering),


Ms. Poonam Pathak (PBL Coordinators) for extending the help to academic
literature.

We express our gratitude to Dr. Madhumita Chatterjee (Principal) for their


constant encouragement, co-operation and support.

We take this opportunity to thank all our classmates for their company during the
course work and for useful discussion we had with them. We would be failing in
our duties if we do not make a mention of our family members including our
parents for providing moral support, without which this work would not have been
completed.

Submitted By

Tanaya Thakur

Shraddha Tamhane

You might also like