Java Based Chat Server

Discussions

Performance and scalability: Java Based Chat Server

  1. Java Based Chat Server (2 messages)

    I am writing a java based chat server and currently my design is based on following :- when a person in a chat room sends a message, the chatroom class at the server side, sends the same message to every participant in the room in a loop. Obviously , this is a poor design because networks calls are being made to individual participants in a loop. Hence, for example, consider there are 10 people in a chat room. When one user sends a message, the chatroom class will send the same message in a loop to all 10 people. if lets say, the 5th person in a loop has a crappy connection, the time when the sixth .. 10th person will see the message will be affected. if i move from unicast to multicast per room, then how do i get a private multicast group ip per chat room? Also, it seems overkill to have individual groups per chat room. So i would like some suggestions on how to broadcast the message to members of the chat room, so they can see the message in almost real time irrespective of indivdiual member's network

    Threaded Messages (2)

  2. Further ideas[ Go to top ]

    My main problem was that when i replied to users in a room via a loop, the method that sent data over socket connection was blocking. Hence, i am thinking if i use non blocking NIO sockets, and then send the message to recipients in a loop, would that solve the problem ?
  3. Re: Java Based Chat Server[ Go to top ]

    Dear Maninder, Have you considered using Openfire? It is a complete XMPP implementation and (yes) does NIO already. Kees Jan