• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Chat Server Design?

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 )
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
reply
    Bookmark Topic Watch Topic
  • New Topic