https://github.com/mahraibfatima/clientserver_messenger
client-server model using Java socket programming.
https://github.com/mahraibfatima/clientserver_messenger
client-server java socket-programming
Last synced: about 1 year ago
JSON representation
client-server model using Java socket programming.
- Host: GitHub
- URL: https://github.com/mahraibfatima/clientserver_messenger
- Owner: MahraibFatima
- Created: 2025-04-20T13:42:42.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-04-20T15:46:51.000Z (about 1 year ago)
- Last Synced: 2025-04-20T16:34:12.301Z (about 1 year ago)
- Topics: client-server, java, socket-programming
- Language: Java
- Homepage:
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readMe.md
Awesome Lists containing this project
README
# Simple Client-Server Chat Application
This project demonstrates a basic client-server communication model using Java socket programming. The client sends a message to the server, which responds with an acknowledgment.
## Components
1. **Client (`clientChat.java`)**: Sends a message to the server and displays the response.
2. **Server (`serverChat.java`)**: Receives the client’s message and responds.
---
## Features
- **Bidirectional Communication**: Client sends a message; server acknowledges it.
- **Socket Programming**: Uses `Socket` and `ServerSocket` classes for communication.
- **Buffered I/O**: Efficient data transfer using `BufferedReader` and `PrintWriter`.
---
## How to Run
### Prerequisites
- Java Development Kit (JDK) installed.
### Steps
1. Compile the files:
```bash
javac clientChat.java serverChat.java
```
2. Start the server:
```bash
java serverChat
```
3. Start the client in another terminal:
```bash
java clientChat
```
4. Enter a message in the client terminal and observe the interaction.
---
## Example
### Server Output
```
Server is working...
Connection Established!
Client says: Hello, Server!
```
### Client Output
```
Client is waiting...
Enter your message:
Hello, Server!
Server says: Hello, Server!
```
---
## Notes
- **Port**: Ensure port `9806` is free.
- **Same Network**: Client and server should run on the same machine or accessible network.
---
This project serves as a straightforward introduction to Java socket programming.