0% found this document useful (0 votes)
3 views17 pages

Instant Messaging System Project Report

The document is a project report for a Class 12 CBSE Computer Science project titled 'Instant Messaging System', which is a Python-based application enabling real-time text messaging between users. It includes sections on project explanation, learning objectives, source code, output screenshots, advantages, disadvantages, and a conclusion highlighting the practical knowledge gained in client-server networking and socket programming. The project demonstrates key features such as message broadcasting and multithreading, while also noting limitations like the lack of a GUI and message encryption.

Uploaded by

startnew35726
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views17 pages

Instant Messaging System Project Report

The document is a project report for a Class 12 CBSE Computer Science project titled 'Instant Messaging System', which is a Python-based application enabling real-time text messaging between users. It includes sections on project explanation, learning objectives, source code, output screenshots, advantages, disadvantages, and a conclusion highlighting the practical knowledge gained in client-server networking and socket programming. The project demonstrates key features such as message broadcasting and multithreading, while also noting limitations like the lack of a GUI and message encryption.

Uploaded by

startnew35726
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Class 12 CBSE Computer Science Project Report

Project Title: Instant Messaging System

Submitted By:

Class: XII

Session: 2025-26

Index

1. Introduction

2. Learning Objectives
3. Project Explanation

4. ER Diagram

5. Flow Chart

6. Source Code

7. Output Screenshots & Explanation

8. Advantages

9. Disadvantages
10. Conclusion
[Link]

Introduction

The Instant Messaging System is a Python-based application that


allows two or more users to exchange text messages in real time.
Instant messaging is widely used today in platforms like
WhatsApp, Telegram, and Messenger. This project demonstrates a
simple version of such a communication system using Python’s
socket programming.

The system consists of:

● A Server Program that handles connections.

● A Client Program that users run to send/receive messages.

This project shows how network communication works using


sockets, threading, and message broadcasting.

Learning Objectives

The main learning objectives of this project are:

● To understand how client-server communication works.

● To learn socket programming in Python.


● To implement multithreading for handling multiple users.

● To send and receive messages in real-time.

● To understand message broadcasting techniques.

● To build a functional mini communication system.

Project Explanation

The Instant Messaging System follows a Client–Server Model.

Server Features:

● Accept multiple client connections.

● Receive messages from one client.


● Broadcast the message to all connected clients.

● Handle clients joining and leaving.

Client Features:

● Connect to server using IP & port.

● Send messages to the server.

● Receive broadcast messages from other users.

● Display messages in real time.

Technologies Used:

● Python 3

● Socket module

● Threading module
ER Diagram
+------------------+
| User |
+------------------+
| Username |
| Client Address |
+------------------+
|
| sends/receives
v
+------------------+
| Message |
+------------------+
| Message Text |
| Timestamp |
+------------------+
``` [cite: 144-158]

## **5. Flow Chart**

+-----------------+ | Start | +-----------------+ v +------------------+ | Run Server | +------------------


+ v +----------------------------+ | Client Connects to Server | +----------------------------+ v
+-----------------------------+ | Client Sends a Message | +-----------------------------+ v
+-----------------------------+ | Server Broadcasts Message | +-----------------------------+ v
+-----------------------------+ | Clients Receive Message | +-----------------------------+ v
(Repeats) ```

Source Code

A) Server Program ([Link])

import socket

import threading
import sys

HOST = "[Link]"

PORT = 5555

clients = []

clients_lock = [Link]()

# ================= SERVER CODE


=================

def broadcast(message, sender):

with clients_lock:

for client in clients:

if client != sender:

try:
[Link](message)

except:

[Link]()

[Link](client)

def handle_client(client, addr):

print(f"Connected with {addr}")

while True:

try:

message = [Link](1024)

if not message:

break

broadcast(message, client)

except:

break
with clients_lock:

if client in clients:

[Link](client)

[Link]()

print(f"Disconnected from {addr}")

def start_server():

server = [Link](socket.AF_INET,
socket.SOCK_STREAM)

[Link](socket.SOL_SOCKET,
socket.SO_REUSEADDR, 1)

[Link]((HOST, PORT))

[Link]()

print("Server running...")
while True:

client, addr = [Link]()

with clients_lock:

[Link](client)

thread = [Link](target=handle_client,

args=(client, addr),daemon=True)

[Link]()

# ============= CLIENT CODE =================

def start_client():

client = [Link](socket.AF_INET,
socket.SOCK_STREAM)

[Link]((HOST, PORT))
def receive():

while True:

try:

message = [Link](1024)

if not message:

print("Server disconnected.")

break

print([Link]())

except:

break

[Link]()

def write():

while True:

try:

message = input()

[Link]([Link]())
except:

break

[Link](target=receive, daemon=True).start()

[Link](target=write, daemon=True).start()

# ================= MAIN =================

if __name__ == "__main__":

if len([Link]) != 2:

print("Usage:")

print(" python [Link] server")

print(" python [Link] client")

[Link](1)

mode = [Link][1].lower()
if mode == "server":

start_server()

elif mode == "client":

start_client()

else:

print("Invalid mode. Use 'server' or 'client'.")

Output Screenshots & Explanation

This section describes the outputs generated when the program is


executed:

Server Output

● Shows the message “Server running…” to indicate the server


has started successfully.

● Displays the addresses of all connected clients.

Client Output

● Users type their messages.


● Messages appear instantly on all connected client windows.

Real-time Chat
● The system successfully demonstrates multiple users
chatting simultaneously.


● ## **7. Output Screenshots & Explanation** This section
describes the program outputs: **Server Output**[cite: 249]: *
Shows **“Server running…”**[cite: 250]. * Displays connected
client addresses[cite: 251]. **Client Output**[cite: 252]: *
Users type messages[cite: 253]. * Messages appear instantly
on all client windows[cite: 254]. **Real-time Chat**[cite: 255]:
* Multiple users are able to chat simultaneously[cite: 256]. * *\
[Insert Output Screenshots Here]* [cite: 68]

Advantages

● Real-time communication.

● Multiple users can chat together.

● Demonstrates socket programming concepts clearly.

● It is an efficient and lightweight system.

● It provides a good foundation for building chat apps like


WhatsApp.
Disadvantages

● No GUI (it is text-based only).

● There is no message encryption.

● Works only on a local network unless port-forwarding is


configured.

● The server must be running all the time for the


communication to work.

Conclusion
The Instant Messaging System project helped me understand how
real-time chat applications work. I gained practical knowledge of
client-server networking, socket programming, and multithreading
in Python. This basic model can be improved into a GUI-based or
mobile-based chat application with additional features like user
authentication, file sharing, and message encryption.
Bibliography

1. Python Documentation

2. W3Schools Python

3. Geeks for Geeks – Socket Programming

4. CBSE Computer Science Syllabus

5. TutorialsPoint Networking in Python

You might also like