Chat application using java.

download Chat application using java.

of 15

description

This Project report is based on java.

Transcript of Chat application using java.

CHAT APPLICATION

INTRODUCTION

Teleconferencing or Chatting, is a method of using technology to bring people and ideas together despite of the geographical barriers. The technology has been available for years but the acceptance it was quit recent. Our project is an example of a chat server. It is made up of 2 applications the client application, which runs on the users Pc and server application, which runs on any Pc on the network. To start chatting client should get connected to server where they can practice two kinds of chatting, public one (message is broadcasted to all connected users) and private one (between any 2 users only) and during the last one security measures were taken.

OBJECTIVES

Communication over a network is one field where this tool finds wide ranging application. Chat application establishes a connection between 2 or more systems connected over an intra-net or ad-hoc. This tool can be used for large scale communication and conferencing in an organization or campus of vast size, thus increasing the standard of co-operation. In addition it converts the complex concept of sockets to a user friendly environment. This software can have further potentials, such as file transfer and voice chatting options that can be worked upon later.

PROJECT CATEGOERY

SOCKET PROGRAMMING-JAVAA socket is one of the most fundamental technologies of computer networking. Sockets allow applications to communicate using standard mechanisms built into network hardware and operating systems. Although network software may seem to be a relatively new "Web" phenomenon, socket technology actually has been employed for roughly two decades.Sockets provide the communication mechanism between two computers using TCP. A client program creates a socket on its end of the communication and attempts to connect that socket to a server. When the connection is made, the server creates a socket object on its end of the communication. The client and server can now communicate by writing to and reading from the socket. The java.net. Socket class represents a socket, and the java.net. Server Socket class provides a mechanism for the server program to listen for clients and establish connections with them.

SYSTEM ANALYSISDFD(DATA FLOW DIAGRAM)SENDS MESSAGESSENDS MESSAGES

ADMINMONITORREQUESTCHAT SERVERUSER

MESSAGES MESSAGESRECIEVESLOGIN

RECIVES MESSAGEVALIDATE USER

ACCESS DENIED/ACCESED

ACCESS GRANTEDADMIN

DENIEDVALIDATEUSERID &PASSWORD

USER

REQUEST FORMONITORING OF DATABASESERVER

LOGIN

SEND&RECEIVE MESSAGE

SERVER

E-R DIAGRAM

Mesag_recievr_IDMessage_ID

Mesag_recieve_ID

Message_IDHas_one_or_manyMessage_reciverSubjectMessage

Message_Text

Reciver_IDAttachments_Id

EXPLANATION OF PROGRAMMINGClient Server CommunicationThe server is bound to a fixed socket and listens for connection requests from clients. The clients try to connect to server on this port and predefined host. Once the communication channels are set up, both talk in terms of objects defined as protocols. Upon receiving these objects the program then extracts relevant information and takes appropriate actions. All communications are through server and may change the protocol parameters if required.ProtocolsSelf designed protocols have been defined to enable communications between server and clients. Protocols have primarily been defined as classed which have required parameters. The objects of these classes are then exchanged

Message ProtocolThis defines how messages are to be handled between users and server. The user can send public and private message. For private message it is important to know the recipient and the sender of the message.

Fields Audience public or private message RoomNumber Currently of no use. In future can be used for multiple rooms RecieverId Id of the recipient. Useful only for private messages SenderId Id of sender. Useful only for private messages Message Text that the user wants to sendClient Information ProtocolThis is meant to exchange client information between user and server. When a new client connects to the server its relevant information is kept in an object of this class. Other users are notified of arrival of new client using information from this protocol.Fields ClientId Identification number of client within the server. ClientName The login name provided by the user.

Chat Request ProtocolThis protocol is used to notify a client that another client wants to start a private chat with it. A message of this type must be sent before any private conversation can start. This message is sent when user chooses to start a private conversation. Upon receiving this request the recipient's client takes steps to receive private messages from the server by the specified sender.Fields SenderId The clientId of the client machine that initiated the request. RecieverId The clientId of the client machine that is to be notified.

Update Client List ProtocolWhen a new user logs in to the server all clients have to be notified of this arrival. Also when a user logs out, all users must be notified. This protocol is used to simplify this process. A message of this type with the new clients name is broadcast to all client machines.Fields Request Type Indicates if the user has to be added or removed ClientName The name of the client that the information is about

Log Out ProtocolWhen a user chooses to logout of the system the server and all other users must be notified. Upon users choice the local client machine sends a message of this type to the server. Upon receiving this message the server forwards it to all clients. Then breaks connection with the client.Join Chat Room ProtocolThis protocol is reserved for when multiple chart rooms will be implemented.Fields Request Type -- Indicates if the user has to be added or removed Room Number RoomId of the room that the user wants to join

Connection Notice ProtocolIf the server rejects the connection then this object is sent to the client. The reason might be over occupied server or clients nick already in use.

MODULES OF PROJECT

1. CHAT SERVER:

The interface has been developed in Swing. Interface has been kept separate from the network processes. The main components of the server interface are as follows:1. Messages Area: Connection acceptance , rejection, login messages are shown here.1. List of Online Users: On the right side of the message window is the list of users that are connected to the server currently. A user can be selected from this list by clicking on name.1. Configure Server Dialog: This dialog is shown when option is selected from the menu. This dialog will allow new values and saving to configuration file.1. Main Menu: The options available for the server . The options includes the configure server, shutdown server

1. CHAT CLIENT:

The interface has been developed in Swing. Interface has been kept separate from the network processes. The main components of the client interface are as follows

1. Message Tabs: These are the conversation tabs. All conversation windows are kept within these tabs. 2. Message Entry Field: This is place at the bottom of the window. This is where the user enters whatever message he/she wants to send. Message is sent by either pressing enter or pressing the send button. Where the message is sent depends on which tab is open.3. Online User List: This list shows all the users who are logged in at the server. Double clicking on a user will open a +conversation window with him .4. Configure Dialog: This dialog is shown when option is selected from the menu. This dialog will allow new values and saving to configuration file. You can change server host name and port.5. Main Menu: The options available for the server. The options include connect, disconnect, configure, exit, close current tab, close all tabs, help.

TESTINGSi.NoDescriptionTest StepsExpected Result

login_001Verify that user should be able to login to the system.Invoke application

Login page should be displayed with the following detailsa)userid-text box b)password text boxc)login-button d) Sign-up link

Enter username and password in login page andclick login button

For the valid user the chat page of corresponding user should be displayed to the user.

Enter username and null passwordA message should be displayed to user entered password

Null username and passwordA message should display Please enter the Fields.

Enter invalid username and password.

Error page should be displayed and prompts user to re-login.

Enter correct username and incorrect password.A message invalid password should be displayed to user.

02.Sending / Receiving messageSender: Type the message in text box, select recipient and click send button.Null messageA message that displays please Enter a message

Enter message and no recipient.A message that displays Please enter recipient

Enter message and recipient addressA message that displays Message Sent.

Receiver:Receive message from sender.Send a message to receiver.Display the message in inbox side.

SOFTWARE AND HARDWARE REQUIREMENTS

SOFTWARE REQUIREMENTSOperating System:Windows 7 Front End:JavaEditor:Netbeans

HARDWARE REQUIREMENTSProcessor: Intel Pentium or AboveRam :512 MB or AboveHard Disc:40 GB or Above

FUTURE ENHANCEMENT & SCOPE

1. Login session information: We can include a feature in this application that will keep a record of the users login session.

2. Offline messages: User can send messages to friends even when they are offline.

3. File transferring and sharing: User can transfer one or more files to other users. A file can also be shared between two or more users.

4. Profile Database: The profile information of every user can be stored at the server.

5. Login Timeout: This feature allows the user to be logged in only for a specific time. After this time span ends, the user is automatically logged out.

Page 10