This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Hello, I have been in the process of working on a simple (very simple) java chat server... it handles the clients with threads and I can even connect to it, send it data and have it send it back, only problem is that it is not broadcasting it to all the connected clients, only the one that sent the data.
I am fairly new to OOP programming, and I started to make my own way to handle clients, but it didnt help work.
I feel there is something I am missing, ive been struggling for days on this, ive been looking up multicasting, but I am not sure if thats what I want.
If anyone could provide me with some insight on how I should handle the clients, broadcast the packets, and anything else, I would appreciate it. I am not asking for code, just design concepts (but code would be nice, just keep it very simple, I do not want to be spoon fed )
Welcome to the JavaRanch, Brian. Multicasting is probably a bad match for your task as it uses UDP and you don't have guaranteed delivery with UDP. The first thing that I think of would be to have the server store all your client connections somewere and every time it receives a client message, use that store to forward the message to each client. Does that sound do-able?