Java TCP Client Server Chat Application using Sockets

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.
Step 4: 

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.

Download Client Example
Download Server Example


  • 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 static IP address for the server app to run.


Recommended for you: Open Source Bulk SMS Sender Android App


Please enter your comment!
Please enter your name here

10 + twenty =