winzip icon

Chatting Application

Submitted on: 1/4/2015 4:11:00 AM
By: KIRAN KUMAR TADAKA (from psc cd)  
Level: Intermediate
User Rating: By 6 Users
Compatibility: Java (JDK 1.4)
Views: 4616
     A simple concurrent chat application: * The application is composed of a Java server application and a client applet. * The chat program will allow multiple students (clients) to talk with each other at the same time as well as to their instructor on the server side. * There can be more than one active chat room at a time A) Server side * Server is a Frame which has the following information. There are 3 classrooms which the server is supervising . The frame shows all the three classrooms as a TextArea which will display the messages from the students logging on to that chatroom. * The server can listen to all the information sent and exchanged among students of a classroom. The server can also talk to any one particular classroom.There is a TextField for the server to type in its messages and on pressing a "SEND" button that messages should be sent to all clients logged on the classroom the server wants to talk to. * Each client should login to the server before entering a classroom. * It shall authenticate studentsí requests to join the chat by means of a username and password. After successful Login, the server will assign the client to the classroom it requested to be signed in for.In This Application The Username and the Password are the Same. * The server keeps track of the clients in each classroom and produce that data whenever the server needs to see it. * Whenever a client logs in or logs out, all the other clients present in that classroom are notified of the new client entry/exit and when the client logs off, its information isdeleted. * When a new user connects to the chat server, a new connection will be created to service the client applet's communication. Multiple clients can communicate with the server via a socket interface. B) Client Side * The client should log on to the server using a Username and Password. It should also provide the server the classroom it wants to log on to. * On sending the information to the client, the server authenticates the username and password and if they match open a new thread to service this client. If the user name and password does not match, then the server should prompt the client.The Username And Password should be same in this application. * The client Applet/Frame shall has GUI for students to log to the server and to be able to chat with other students (the interface displays a list of other students in the same chat room). * The interface has a TextArea to display the messages sent by other clients in that chatroom. The interface should also provide a TextField for the client to type its questions and send it to the server. * The client will be able to see the messages sent by the server to its classroom. * Clients cannot see the messages sent by other clients present in different classrooms. * Whenever a fresh client logs on to the classroom in which the old client is logged on, then the information about that client is visible immideatly i.e. the all clients updates its classroom list to display the new client automatically. * The client can send messages to other students in the same chat room or ask his instructor a question. * The client shall be able to logout or to exit at any time.

winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net

Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)

Other User Comments

 There are no comments on this submission.

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)

To post feedback, first please login.