W3C home > Mailing lists > Public > ietf-http-wg@w3.org > July to September 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.");

			PrintWriter os = new PrintWriter(clientSocket.getOutputStream(),true);
//DataInputStream is = new DataInputStream(clientSocket.getInputStream());
			BufferedReader is =new BufferedReader(new 
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");

		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?
Received on Sunday, 29 July 2001 08:36:19 UTC

This archive was generated by hypermail 2.4.0 : Thursday, 2 February 2023 18:43:08 UTC