Simple chat room server program implemented in Java.
This is a multi-threaded server program that listens on a port for a new connection and maintains a list of all the active connections while synchronizing access to said list using locks.
The purpose of this assignment was to learn about multi-threading and networking concepts.
Client Request | Server Response | Meaning |
---|---|---|
Join chatroom with valid ID/Username u | Welcome message |
|
COMMANDS | List of commands |
|
LISTALL | List of current participants |
|
COUNTALL | Number of current participants |
|
WHOAMI | Current username |
|
EDITUSER u | Username change confirmation message |
|
EXIT | Exit message |
|
Any other input line after joining chatroom message | Chat message |
|
Use Eclipse to clone the repository and run program to establish test connection with server.
Use Telnet as client to connect to server.
- Install Eclipse IDE.
- Open Eclipse and go to File > Import...
- In the Import window, select Git > Projects from Git and click Next.
- In the Select Repository Source window, select Clone URI and click Next.
- In the Source Git Repository window, enter the URI
https://github.com/LeanetAlfonso/ChatRoomServer.git
and click Next. - In the Branch Selection window, select main and click Next.
- In the Local Destination window, enter a local directory and click Next.
- In the Select a Wizard to use for importing projects window, select Import existing Eclipse projects and click Next.
- In the Import Projects window, select the project and click Finish.
- Run ChatRoomServer.Java
- Type
telnet localhost 3333
at the command line to connect to the chatroom server (you must install Telnet before you can run this command). Run the command from different windows to simulate multiple client connections.