Simple LAN-Based Chatting System using Java


This article that I will going to write is about chatting system using java as programming language. The tutorial will just showcase only the fundamentals of chatting system where data sent and accept by the user. The system will not include the GUI (graphic user interface) but only a console interface.
The first thing we do is to create a java file that will serve as our message sending module. As the user sends the message, the string will be converted into bytes and travel in LAN(Local Area Network) as a packet data. The code that we are going to put is the following below:

Second, we will create our Listener java file that will accept the message being sent by the Sender java file. In the listener module, the packet data which is our string message will be converted into bytes and bytes will be converted into a string. It is the reverse transformation that happens in Sender Java. Since it is string now, we can see it in our console the message that the sender sent.

Download “Simple LAN-Based Chatting System Sample Code” – Downloaded 50 times – 928 B