This project presents a simple yet robust chat application developed with C# Windows Forms and WebSocket communication. Users can engage in real-time messaging over a local network, facilitated by WebSocket technology. The application seamlessly stores chat logs in a SQL Server database.
- Real-time chat between users on the same local network.
- Database storage of chat messages with sender and receiver IP addresses.
- User-friendly Windows Forms interface.
Before running the application, make sure you have the following prerequisites:
- Visual Studio with C# support (for development).
- SQL Server (for database storage).
-
Clone this repository to your local machine:
git clone https://github.com/yourusername/your-repo-name.git
-
Open the project in Visual Studio.
-
Modify the
connectionString
variable inForm1.cs
to point to your SQL Server instance:private string connectionString = "Server=YOUR_SERVER;Database=client logs;Integrated Security=True;";
-
Build and run the application.
- Start the application on two different computers within the same local network.
- Enter the local IP address of each computer and port numbers in the appropriate fields.
- Click the "Start" button to connect the two computers.
- Send messages in the chat box, and they will be displayed in real-time on both computers.
- Chat messages are stored in the SQL Server database.
This chat application leverages WebSocket communication to enable real-time messaging between users on the same local network. WebSocket is a protocol that provides full-duplex communication channels over a single TCP connection. WebSocket communication enables low-latency, bidirectional messaging, making it suitable for real-time chat applications.
You can find the database configuration in the CheckDatabaseConnection
and StoreMessageData
methods in Form1.cs
. Ensure that your SQL Server is configured correctly for this application to work.
If you'd like to contribute to this project, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix:
git checkout -b feature-name
. - Make your changes and commit them:
git commit -m 'Description of your changes'
. - Push to the branch:
git push origin feature-name
. - Create a pull request on GitHub.