hello members
i am building a client server chat application and apparently the server can receive a message from the client and send that message to all the clients connected to the server.
that is not what i want,all i want is explained below

When a user types something into their chat window, their message will be sent as a string through a DataOutputStream.

When the server receives a message, through a DataInputStream, it will send this same message to a specific user(client) connected to the server, again as a string through a DataOutputStream.

The users will use a DataInputStream to receive the message.

here is a copy of the serverthread code

import java.io.*;
import java.net.*;
 
public class ServerThread extends Thread
{
  // The Server that spawned us
  private Server server;
 
  // The Socket connected to our client
  private Socket socket;
 
  // Constructor.
  public ServerThread( Server server, Socket socket ) {
 
    // Save the parameters
    this.server = server;
    this.socket = socket;
 
    // Start up the thread
    start();
  }
 
  // This runs in a separate thread when start() is called in the
  // constructor.
  public void run() {
 
    try {
 
      // Create a DataInputStream for communication; the client
      // is using a DataOutputStream to write to us
      DataInputStream din = new DataInputStream( socket.getInputStream() );
 
 
      while (true) {
 
        // ... read the next message ...
        String message = din.readUTF();
 
        .
        System.out.println( "Sending "+message );
 
        //  have the server send it to all clients
        server.sendToAll( message );
      }
    } catch( EOFException ie ) {
 
 
    } catch( IOException ie ) {
 
      // This does; tell the world!
      ie.printStackTrace();
    } finally {
 
      // The connection is closed for one reason or another,
      // so have the server dealing with it
      server.removeConnection( socket );
    }
  }
}