server side programming?

Hi ,
I ve been trying to write  a small HTTP Server app. which shall take in 
requests from browser and send some results back (in Java).
serverSocket is created on port 4444.
Following is a snippet from the code --


Socket clientSocket = null;

        try {
            clientSocket = serverSocket.accept();
        } catch (IOException e) {
            System.err.println("Accept failed.");
            System.exit(1);
        }

			PrintWriter os = new PrintWriter(clientSocket.getOutputStream(),true);
//DataInputStream is = new DataInputStream(clientSocket.getInputStream());
			BufferedReader is =new BufferedReader(new 
InputStreamReader(clientSocket.getInputStream()));
String fromServer=new String();
while ((fromServer = is.readLine()) != null) {

    System.out.println("Server: " + fromServer);


	os.println("<html>hello lhlg  </html>");
	System.out.println("Server:  before flush");

	 os.flush();
		System.out.println("Server: after flush");
}
}

Even though server receives some data it is unable to post data back.
Any ideas where I might be going wrong?
Thanks
Tapan

Received on Sunday, 29 July 2001 08:36:19 UTC