> how do it make a server listen to multiple clients
> and process them.
>
> so far i have reached just this
>
> while(true)
> socket=serversocket.accept();
>
> but what after this.how to handle separate each
> client........
For threading go through this
http://java.sun.com/docs/books/tutorial/essential/concurrency/
> while(true)
> socket=serversocket.accept();
You have to start a new thread for each client and then do the needful.
Say you can implement two different threads to handle the messages to be sent and the messages to be received. Get the required inputstream and outputstream for the socket and use it in each thread.
like
BufferedReader in=new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
PrintWriter out=new PrintWriter(clientSocket.getOutputStream(),true);