r/learnjava • • Aug 05 '26

TCP chat app

Hi everyone.

I'm a 34 year old waiter who is completing an undergrad in Computing and a module in the next semester is Event Driven Programming.

To get a jump on next year, I got some ideas online for projects. I started with a basic gui calculator built using SwingUI. I already understood that the buttons would be the event actions etc.

I then seemed to find that a basic terminal TCP chat server with multiple clients was the next step. This is where I am stuck.

I watched multiple videos from BroCode to NeuralNine to try to get a brief overview. After a quick search online I ended up copying the w3schools example.

I have it working and can connect to multiple clients, but when I try to understand how it works I draw a blank.

What I understand:

- that there is a server and clients connect to the server.

- they communicate via TCP

- When a client sends a message it gets broadcast via the server to all connected clients.

I just want to add to the code and refactor to help me understand it more but I feel completely lost when trying to do so.

Any pointers on what I should do would be appreciated. TIA

0 Upvotes

5 comments sorted by

View all comments

Show parent comment

2

u/Modern-Sn1p3r Aug 05 '26

This seems like the best approach from what I was failing to explain.

Thanks a lot. I'll definitely try this when I'm at the desk, a break away is needed for now.