title: how to find ip address of all connected clients in multi-client/server application in java?
body: <p>i have created a simple multi-client/server app in java.
  and i want to get the list of all connected clients.
  how can i get the ip address of all connected clients?
  i referred and tried code on this <a href="http://irate.shu.edu/~wachsmut/Teaching/CSAS2214/Virtual/Lectures/chat-client-server.html" rel="nofollow">creating simple client/server app</a>
  link for creating simple app</p>
  
  <p>server Code:</p>
  
  <pre><code>public class ChatServer implements Runnable
  { 
        private ServerSocket     server = null;
        private Thread           thread = null;
        private ChatServerThread client = null;
  
        public ChatServer(int port)
        {  try
  
           {  System.out.println("Binding to port " + port + ", please wait  ...");
              server = new ServerSocket(port);  
              System.out.println("Server started: " + server);
              start();
           }
           catch(IOException ioe)
           {  System.out.println(ioe); }
  
        }
       public void run()
       {  while (thread != null)
          {  try
             {  System.out.println("Waiting for a client ..."); 
                addThread(server.accept());
             }
             catch(IOException ie)
             {  System.out.println("Acceptance Error: " + ie); }
           }
       }
  
      public void addThread(Socket socket)
      {   System.out.println("Client accepted: " + socket);
          client = new ChatServerThread(this, socket);
          try
          {  client.open();
             client.start();
          }
          catch(IOException ioe)
          {  System.out.println("Error opening thread: " + ioe); }
      }
  
      public void start()                  
      public void stop()                    
      public static void main(String args[])
  </code></pre>
  
  <p>}</p>
  
  <p>any help will be appreciated.</p>