W3C home > Mailing lists > Public > ietf-http-wg-old@w3.org > May to August 2001

server side programming?

From: Tapan Divekar <tapan_divekar@hotmail.com>
Date: Sun, 29 Jul 2001 07:35:14 +0000
To: http-wg@cuckoo.hpl.hp.com
Message-ID: <F223bLYluLCTaogxLDp00008f8c@hotmail.com>
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


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
Received on Sunday, 29 July 2001 08:36:19 EDT

This archive was generated by hypermail pre-2.1.9 : Wednesday, 24 September 2003 06:33:43 EDT