• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Chat Server Design?

 
Brian Smithy
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 )
 
Joe Ess
Bartender
Posts: 9313
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic