I have been trying to send multiple messages from client to server & do a comparison with a value read from a file. Until I added the comparison part, I had got everthing working. Ever since I did comparison, server doesn echo wat user writes in the client. M running out of time but I can't get the code to do what I want, pls help.

SERVER:

Code:
 /*Does encryption and decryption, check car existence(read file), 
check timestamp differs from current timestamp no more than 1 min, 
if more than 1 min request retransmission Ability of branch to manage car, nform C if can't manage*/

import java.io.*;
import java.net.*;
import java.util.*;

public class AS{
    public static void main(String[] args ){
        int i = 1;

        try{
             ServerSocket s = new ServerSocket(9001);

             for (;;){
                 Socket incoming = s.accept( );
                 System.out.println("Spawning " + i);
                 new RealEchoHandler(incoming, i).start();
                 i++;
             }
        } catch (Exception e){ System.out.println(e); }
    }
}

class RealEchoHandler extends Thread{
	DataInputStream in;
	DataOutputStream out;
	FileInputStream fin = null;
    BufferedInputStream buff = null;
    DataInputStream ds = null;


	private Socket incoming;
    	private int counter;

    public RealEchoHandler(Socket i, int c){
        incoming = i;
        counter = c;
    }

    public void run(){
        try {

            in = new DataInputStream(incoming.getInputStream());
	    out = new DataOutputStream(incoming.getOutputStream());

            boolean done = false;
            String str="";
            String store="";
            String [] temp;

            out.writeUTF("Connected!\n");
            out.flush();

	    out.writeUTF(">");
	    str = in.readUTF();
	    out.writeUTF("Echo (" + counter + "): " + str+"\n");
	    System.out.println(in+"Echo:"+str);
	    out.flush();


                   
            while (!done){
			
                if (str == null)
                    done = true;

                else{
                     out.flush();
                }
            }
                File fil = new File("CarBranchInfo.txt");
                
                fin = new FileInputStream(fil);
                buff = new BufferedInputStream(fin);
                ds = new DataInputStream(buff);
                
                /* delimiter */  
                String delimiter = " ";
                while (ds.available() != 0) {

               // this statement reads the line from the file 
               store = ds.readLine();
               /* given string will be split by the argument delimiter provided. */
               temp = store.split(delimiter);
               
               for(int idx=0; idx < temp.length; idx++)
               {
                 if (str.equals(temp[idx]))
                  {
                    System.out.print("Car Exists!");
                  }
               }
               
      }
      
            // dispose all the resources after using them.
            fin.close();
            buff.close();
            ds.close();
            incoming.close();
         } catch (Exception e){
             System.out.println(e);
         } 

    }
CLIENT:

Code:
 // C generates session key and subscripts it, does encryption & decryption
//Check timestamp doesn't differ from curr time for more than 1 min
//Timestamp value should be same everywhere

import java.io.*;
import java.net.*;
import java.util.*;
import java.sql.Timestamp;

class Client{
	public static void main(String[] args) {
		String str1="";
		String str2="";
		String str3="";
		String str4="";
        String clientCar="";
		String clientBranch="";
		String clientDriver="";
		String clientPasswd="";

		DataOutputStream out;
		DataInputStream in;


		try {
		    Socket t = new Socket("127.0.0.1", 9001);

              	    in = new DataInputStream(t.getInputStream());
                    out = new DataOutputStream(t.getOutputStream());
           

		 BufferedReader br = new BufferedReader
                     (new InputStreamReader(System.in));
                        
			boolean more = true;
			System.out.println(in.readUTF());
            

		while (more) {

				clientCar = in.readUTF();
			    	System.out.print(clientCar);
			    	
			    clientBranch = in.readUTF();
			    	System.out.print(clientBranch);
			    	
			    clientDriver = in.readUTF();
			    	System.out.print(clientDriver);
			    	
			    clientPasswd = in.readUTF();
			    	System.out.print(clientPasswd);
		
		str1 = br.readLine();
		str2 = br.readLine();
		str3 = br.readLine();
		str4 = br.readLine();
		
		out.writeUTF(str1);
		out.writeUTF(str2);
		out.writeUTF(str3);
		out.writeUTF(str4);
		out.flush();
		
		clientCar = in.readUTF();	    
                
                if (clientCar == null)
                    more = false;
                else
                    System.out.print(clientCar);
                    
        clientBranch = in.readUTF();
       
               if (clientBranch == null)
                    more = false;
                else
                    System.out.print(clientBranch);
                    
        clientDriver = in.readUTF();
       
               if (clientDriver == null)
                    more = false;
                else
                    System.out.print(clientDriver);
                    
        clientPasswd = in.readUTF();
       
               if (clientBranch == null)
                    more = false;
                else
                    System.out.print(clientPasswd);
                    
                    
            }

         } catch(IOException e){
			    System.out.println("Error" + e);
	     }
	      //System.out.print(str);
	     //java.util.Date date= new java.util.Date();
	     //System.out.println(new Timestamp(date.getTime()));

     }
}



}