Group Chat Project Report
Group Chat Project Report
of
BACHELOR OF TECHNOLOGY
in
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING
at
DAYANANDA SAGAR UNIVERSITY
5TH SEMESTER
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:___________ ____________________________
____________________________
ii
ACKNOWLEDGEMENT
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.
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
1. Introduction 1
2. System requirements 2
3. System design 3
4. System implementation 6
4.2 Pseudocode 7
5. Output screenshots 11
6. Conclusion 13
7. References 14
v
1. INTRODUCTION
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.
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:
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.
Software requirements:
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:
4
Fig (3.1.2) – Data flow diagram
5
4. SYSTEM IMPLEMENTATION
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.*;
if (args.length != 2)
else
try
name = sc.nextLine();
socket.setTimeToLive(0);
socket.joinGroup(group);
7
ReadThread(socket,group,port));
t.start();
while(true)
String message;
message = sc.nextLine();
if(message.equalsIgnoreCase(GroupChat.TERMINATE))
finished = true;
socket.leaveGroup(group);
socket.close();
break;
DatagramPacket(buffer,buffer.length,group,port);
socket.send(datagram);
catch(SocketException se)
se.printStackTrace();
catch(IOException ie)
8
System.out.println("Error reading/writing from/to socket");
ie.printStackTrace();
this.socket = socket;
this.group = group;
this.port = port;
@Override
while(!GroupChat.finished)
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
11
6. CONCLUSION
Limitations:
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
13