I'm writing a WebChat application using the socket functions in java.
I'm able to listen for incoming sockets on the server side and connect from the client side just fine, but I'm having a problem communicating from the client to the server to ALL the clients.
Right now, I have it set up so my ServerSocket is running in its own thread, constantly listening for connections on a specified port. If it receives a connection, it opens up another thread dedicated to the client socket.
So now, the client socket can communicate back and forth with just the client. What would be a good way to make it able to communicate with ALL the other clients simultaneously? Is taking this kind of socket approach the right way to do something like this? What would be better?