Thanks to visit codestin.com
Credit goes to github.com

Skip to content

A simple chatroom using socket programming in Java, where a server facilitates real-time communication by managing connections and message exchanges between multiple clients.

License

Notifications You must be signed in to change notification settings

leoshad9/chat-room

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Chatroom

This repository demonstrates basic server-client communication where multiple clients connect to a server and exchange messages.

Requirements

  • Java Development Kit (JDK) 8 or higher
  • Basic knowledge of Java and socket programming

Files

  • Server.java: The server-side code that handles client connections and message broadcasting.
  • Client.java: The client-side code that connects to the server and sends/receives messages.

Running the Application

1. Compile the Code

Open a terminal or command prompt and navigate to the directory containing the Java files. Compile the server and client code using the following commands:

javac Server.java
javac Client.java

2. Start the Server

Run the server in one terminal:

java Server

You should see the message: Chat server started....

3. Start the Client(s)

Open another terminal (or multiple terminals for multiple clients) and run the client:

java Client

The client will connect to the chat server at localhost on port 5555. You can start typing messages in the client terminal, and they will be broadcast to all connected clients.

Usage

  • Server: Accepts incoming client connections and broadcasts messages.
  • Client: Connects to the server, sends messages, and displays received messages.

Example

After starting the server and one or more clients, messages sent from any client will appear in the terminal of all connected clients.

For example:

Client A: Hello everyone!
Client B: Hello Client A!

Both messages will be displayed in the terminals of all connected clients.

Contributing

If you have suggestions or improvements, feel free to fork the repository and submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

A simple chatroom using socket programming in Java, where a server facilitates real-time communication by managing connections and message exchanges between multiple clients.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages