A long time ago to do a thing, now take it out and put it in your own blog!
I. Design OBJECTIVES
With the development of people's Internet, the way of communication between people is more convenient and diversified, the online chat tool has become an indispensable part of people's life, after learning
Java Network Programming Course , if you can develop a chat tool for your own, and friends for private conversations, it is an exciting thing. At the same time, the two types of secure and reliable TCP
Communication protocols, which are very important content, are worth studying.
Two. Design content
This chat room program is based on the C/S mode, the chat room is divided into the server side and the client two parts, the server-side program is mainly responsible for listening to the message sent by the client, the client needs to login to the service
To achieve normal chat functionality.
Through the project design practice, to master the GUI program design, multithreading technology, TCP-based socket communication programming.
Three Detailed function description for each module.
The simple chat room is designed for many people who love chatting, and many large web chat rooms compared to the small chat room function is relatively simple, but can achieve basic chat function,
Point-to-multipoint, point-to-point chat and basic user functions, login, logout, view online users, etc.
(1) User settings:
Function Description: User to customize their own login name, successfully set up, the server can receive the new settings of the user name;
(2) Login function:
Function Description: In the case of server-side open, the user can log on to the client with their own custom or the default login name and login address port, and can display the login status on the servers side;
(3) Group chat:
Function Description: The user can choose to chat with "Everyone" in the chat room, the other online users in the chat room can receive and display the public chat message properly.
(4) Private chat:
Feature Description: Users can choose to chat with other users in the chat room's online users list. Chat logs on both sides are not visible to other users of the chat room.
(5) Chat mood:
Function Description: Users in the process of chatting can choose the corresponding mood to express their feelings.
(6) System message:
Function Description: During the normal operation of the service, every user in the chat room can receive the information message from the server side.
(7) User status:
Function Description: Each client user can see the status of other online users in real time.
(8) User logoff:
Function Description: The user can log off their account and re-register the login name and address.
(9) User exit:
Function Description: The user can exit the chat room under normal circumstances.
(10) Server side:
Function Description: Only in the case that the server is open, the user can log on successfully and chat; The address port set by the user must also be the same as the listening port on the server, otherwise you cannot log on.
(11) Screenshot:
Function Description: The client has the same mouse click to implement the screenshot and then automatically rename to prevent overwriting.
---Preface to Java-based web chat rooms