title: algorithm of chat application in java using sockets
body: <p>I have to make a web application for chat which will work as skype, like 1 to 1 chat as well as group chat.</p>
  
  <p>Last some days i am researching on google and i come to know following things.</p>
  
  <p>For making speed better, i must use sockets. Database must in involved for storing the history of chat.</p>
  
  <p>Last 1 year, i am working on java but unfortunately never worked on socket connection.</p>
  
  <p>There are some online code available, even i tried to understand it as well but its all gone above my head.</p>
  
  <p>But couple of things i come to know as follows</p>
  
  <ol>
  <li>Server class need to configure the sockets.</li>
  <li>client class need to send the message through the sockets.</li>
  </ol>
  
  <p>My question is how i will come to know that a specific message is send to specific group or person...??</p>
  
  <p>As only 1 socket is connecting to all group, a particular message will go to all.</p>
  
  <p>I do not need a example, i just need to make a algorithm right so that i can start work on.</p>