This is a very simple Client/Server Chat Application using TCP Sockets Java.
Complete Code for Client & Server can be found below for download.
How it Works
Here is an example of how a very simple client-server chat application works. These are the stages involved:
|Step 1: In any Client/Server Application, we need to run the server before the client, because the server keeps waiting for the client to be connected.|
|Step 2: Server keeps listening for the client on an assigned IP & Port|
|Step 3: For establishing connection client must know the IP & Port of the server.|
When we start Client Application, It creates a connection to the server.
|Step 5: After the Successful connection Client & Server Applications can send & receive messages.|
You can download complete code for client & server examples below.
- Can we run these Chat Applications on different Computers?
Yes, you can use these applications on different computers but both computers should be on the same network.
- Will this Client-Server Chat Applications work on Different Networks?
For using this application on different networks you must have a Public IP address for the server app to run.
Recommended for you: Open Source Bulk SMS Sender Android App
Recommended Training – Treehouse
From beginner to advanced, our recommended coding training is Treehouse.
Treehouse is an online training service that teaches web design, web development and app development with videos, quizzes and interactive coding exercises.
Treehouse's mission is to bring technology education to those who can't get it, and is committed to helping its students find jobs. If you're looking to turn coding into your career, you should consider Treehouse.
Disclosure of Material Connection: Some of the links in the post above are “affiliate links.” This means if you click on the link and purchase the item, we will receive an affiliate commission. Regardless, we only recommend products or services we use personally and believe will add value to our readers.