0% found this document useful (0 votes)
512 views18 pages

Group Chat Project Report

This document summarizes a group chat application project created by 4 students for their 5th semester operating systems course. It includes an introduction, system requirements, system design overview using data flow diagrams, and module descriptions. The core functionality allows multiple clients to connect to a server to chat with each other in a group chat environment.

Uploaded by

Soham Jain
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)
512 views18 pages

Group Chat Project Report

This document summarizes a group chat application project created by 4 students for their 5th semester operating systems course. It includes an introduction, system requirements, system design overview using data flow diagrams, and module descriptions. The core functionality allows multiple clients to connect to a server to chat with each other in a group chat environment.

Uploaded by

Soham Jain
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
You are on page 1/ 18

GROUP CHAT APPLICATION

Shubhra Rao Kuthyar - ENG17CS0211


Shweta Ranjan - ENG17CS0212
Soham Jain - ENG17CS0216
Tej Pratap Singh - ENG17CS0229

of
BACHELOR OF TECHNOLOGY
in
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

at
DAYANANDA SAGAR UNIVERSITY

SCHOOL OF ENGINEERING, BANGALORE-560068

5TH SEMESTER

(Course Code: 16CS303)

OPERATING SYSTEMS

i
DAYANANDA SAGAR UNIVERSITY

CERTIFICATE

This is to certify that the Object Oriented Programming Mini-Project report entitled “Group
Chat Application” being submitted by ______________________ to Department of Computer
Science and Engineering, School of Engineering, Dayananda Sagar University, Bangalore, for
the 5th semester B.Tech C.S.E of this university during the academic year 2019-2020.

Date:___________ ____________________________

Signature of the Faculty in Charge

____________________________

Signature of the Chairman

ii
ACKNOWLEDGEMENT

We are pleased to acknowledge Mr. Shamanth N., Assistant Professor, Department of


Computer Science & Engineering for his invaluable guidance, support, motivation and patience
during the course of this mini- project work.

We extend our sincere thanks to Dr. Banga M.K , Chairman, Department of Computer Science
& Engineering who continuously helped us throughout the project and without his guidance, this
project would have been an uphill task.

We have received a great deal of guidance and co-operation from our friends and we wish to
thank one and all that have directly or indirectly helped us in the successful completion of this
mini-project work.

Shubhra Rao Kuthyar (ENG17CS0211)


Shweta Ranjan (ENG17CS0212)
Soham Jain (EN17CS0216)
Tej Pratap Singh (ENG17CS0229)

iii
ABSTRACT

Several network systems are built to communicate with one another as well as made available
through service-oriented architectures. In this project, the client server architecture is used to
develop a chat application using Multicast Socket. The IP stack caters to multiple applications
listening on the same multicast group and port at the same time. Every message that the users
enter in the entry are displayed by both clients.

This Java Chat application is a console application that is launched from the command line. The
server and clients can run on different computers/terminals in the same network, e.g. Local Area
Network (LAN). There can be multiple clients connect to a server and they can chat to each
other, just like in a chat room where everyone can see other users’ messages. There’s no private
chat between two users, for simplicity. After getting connected to the server, a user must provide
his or her name to enter the chat.

iv
TABLE OF CONTENTS

Chapter No. Title Page No.

1. Introduction 1

1.1 Problem statement 1

1.2 Objectives of the project 1

2. System requirements 2

2.1 Functional requirements 2

2.2 Software and hardware requirements 2

3. System design 3

3.1 Data flow diagram 4

4. System implementation 6

4.1 Module description 6

4.2 Pseudocode 7

5. Output screenshots 11

6. Conclusion 13

7. References 14

v
1. INTRODUCTION

1.1 PROBLEM STATEMENT

A group chat application using Multicast Socket programming. The aim is to build a working
chat application that is a console application launched from the command line. The server and
clients can run on different computers or the same computer in the same network.

1.2 OBJECTIVES OF THE PROJECT

 To create a chat application with a server and to enable the users to chat with each
other.
 To develop an instant messaging solution to enable 2 or more users to seamlessly
communicate with each other.
 To build a basic application such that even a novice person should be able to use it
with ease.

1
2. SYSTEM REQUIREMENTS:

2.1 FUNCTIONAL REQUIREMENTS:

This section will cover the functional requirements of the chat application.

 Provide name
User should be able to enter his/her name so that other users can be notified of who is
chatting.
 Send a message
This aspect will give the user the ability to send a message to the group.
 Logout
This aspect will give the option to logout of the chat application.

2.2 SOFTWARE AND HARDWARE REQUIREMENTS:

Software requirements:

Programming language: Java


IDE: Eclipse or any Java compiler

Hardware requirements:

The computer used to obtain the results is a MacBook with an Intel Core 2 Duo 2Ghz CPU with
4GB DDR3 1067Mhz RAM.

2
3. SYSTEM DESIGN:

 Socket Overview:
A socket is an object that represents a low-level access point to the IP stack. This socket
can be opened or closed or one of a set number of intermediate states. A socket can send
and receive data. Data is generally sent in blocks of few kilobytes at a time for efficiency,
each of these blocks are called a packet. All packets that travel on the internet must use
the Internet Protocol. This means that the source IP address, destination address must be
included in the packet. Most packets also contain a port number.

A port is a number between 1 and 65,535 that is used to differentiate higher protocols.
Ports are important when it comes to programming your own network applications
because no two applications can use the same port.

 UDP Ports
The User Datagram Protocol is an unreliable, connectionless oriented protocol that uses
an IP address for the destination host and a port number to identify the destination
application. The UDP port number is distinct from any physical port on a computer such
as a COM port or an I/O port address. The UDP port is a 16-bit address that exists only
for the purpose of passing certain types of datagram information to the correct location
above the transport layer of the protocol stack.

 The multicast datagram socket class is useful for sending and receiving IP multicast
packets. A MulticastSocket is a (UDP) DatagramSocket, with additional capabilities for
joining "groups" of other multicast hosts on the internet. A multicast group is specified
by a class D IP address and by a standard UDP port number. Class D IP addresses are in
the range 224.0.0.0 to 239.255.255.255, inclusive.

3
3.1 DATA FLOW DIAGRAM:

Fig (3.1.1) – Work flow diagram

4
Fig (3.1.2) – Data flow diagram

5
4. SYSTEM IMPLEMENTATION

4.1 MODULE DESCRIPTION

1. Server Application: -It will act as a broadcasting server which will handle the sending and
receiving of messages. It’s the parts which have to deal with UDP and port number and
techniques. Its predefined logic handles where to send messages, from where it has been received
and what data has to carry.

2. Client Application: -Using the client panel, client can login to their account using their
username and password. It’s the panel where message exchange process will take place and their
representation medium among other clients.

6
4.2 PSEUDO CODE

import java.net.*;

import java.io.*;

import java.util.*;

public class GroupChat

private static final String TERMINATE = "Exit";

static String name;

static volatile boolean finished = false;

public static void main(String[] args)

if (args.length != 2)

System.out.println("Two arguments required: <multicast-host> <port-number>");

else

try

InetAddress group = InetAddress.getByName(args[0]);

int port = Integer.parseInt(args[1]);

Scanner sc = new Scanner(System.in);

System.out.print("Enter your name: ");

name = sc.nextLine();

MulticastSocket socket = new MulticastSocket(port);

socket.setTimeToLive(0);

socket.joinGroup(group);

Thread t = new Thread(new

7
ReadThread(socket,group,port));

t.start();

System.out.println("Start typing messages...\n");

while(true)

String message;

message = sc.nextLine();

if(message.equalsIgnoreCase(GroupChat.TERMINATE))

finished = true;

socket.leaveGroup(group);

socket.close();

break;

message = name + ": " + message;

byte[] buffer = message.getBytes();

DatagramPacket datagram = new

DatagramPacket(buffer,buffer.length,group,port);

socket.send(datagram);

catch(SocketException se)

System.out.println("Error creating socket");

se.printStackTrace();

catch(IOException ie)

8
System.out.println("Error reading/writing from/to socket");

ie.printStackTrace();

class ReadThread implements Runnable

private MulticastSocket socket;

private InetAddress group;

private int port;

private static final int MAX_LEN = 1000;

ReadThread(MulticastSocket socket,InetAddress group,int port)

this.socket = socket;

this.group = group;

this.port = port;

@Override

public void run()

while(!GroupChat.finished)

byte[] buffer = new byte[ReadThread.MAX_LEN];

DatagramPacket datagram = new

DatagramPacket(buffer,buffer.length,group,port);

String message;

try

9
socket.receive(datagram);

message = new

String(buffer,0,datagram.getLength(),"UTF-8");

if(!message.startsWith(GroupChat.name))

System.out.println(message);

catch(IOException e)

System.out.println("Socket closed!");

10
5. OUTPUT SCREENSHOTS

Fig 5.1 – Output Screenshot

11
6. CONCLUSION

Limitations:

 There is no graphical user interface (GUI). So there are no chat windows.


 The absence of unique user identifications will lead to the nickname collision problem.
 There is no encryption of message strings being sent across the network.

Future enhancements and Conclusion:

This chat application is a system created for the community of people to interact with one
another. This system provides solution to most of the shortcomings of the traditional system. The
system preserves a great amount of time and effort. But the most important thing should be
flexible to accept further modification.
Limitations mentioned above can be addressed in improvements.
 A graphical user interface (GUI) will preclude the need to write the name of destination
user when sending messages and make it more users friendly.
 Current design does not encrypt the text strings. An enhanced design can use encryption
of string using SSL for improved security.
 A database of users containing username and password can be coupled with the existing
design to maintain user accounts.
 An improved version can include multiple servers, serving different geographical
locations, while talking to each other. This will preclude messages between clients
located close to each other being routed through a server located in a far off location, thus
decreasing the delay.
 Right now we are just dealing with text communication. In future this software may be
extended to include features such as:
o File transfer: this will enable the user to send files of different formats to others
via the chat application.
o Voice chat and voice call: this will enhance the application to a higher level where
communication will be possible via voice calling as in telephone.
o Video chat and video call: this will further enhance the feature of calling into
video communication.

12
7. REFERENCES

[1] Open Source Chat Servers in Java - http://java-source.net/open-source/chat-servers

[2] The Singleton Design Pattern - Brian D Foy


http://www.theperlreview.com/Articles/v0i1/singletons.pdf

[3] Internet Relay Chat - http://en.wikipedia.org/wiki/Internet_Relay_Chat

13

You might also like