updating and using String in multiple threads

Hello all,

I am attempting to create a basic chat program and I am having some difficulties as I am trying to use threads for it. There is a single Server object that listens for Client connects, and assigns each one to its own thread. The problem is that I'd like all threads to 'receive' any string generated by all clients, for outputting purposes.

Can I have an instance variable in my Server class that each thread can write to as well as outputting that variable if it has been outdated since last check, or is that just nonsense? A little new to threading here...

Thanks in advance,



  • Your server needs to keep track of all connected clients. if it receives a message from any client then it needs to notify all other connected clients. You need something like a handler that will control/handle any client request/responses.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion