Hi experts,

    I am just wrting a string to a servlet and then trying to read that
string via a servlet running in my machine.  I am able to write to a
servlet and while the servlet is reading that string i was forced to
have an input stream in my code below then only my servlet is reading
the data and storing.  My question is that why is that i need a
inputstream there in my code, i open an outputstream write to a servlet
close that and then servlet opens an bufferedwriter reads that string
and stores what is the xact need of the inputstream here Please clarify
my doubt.

Thanks
Srini

    URL url = new URL("http://164.164.61.118:8080/servlet/ss");
    URLConnection urlc = url.openConnection();
    urlc.setDoOutput(true);
    OutputStreamWriter osw = new
OutputStreamWriter(urlc.getOutputStream());
    osw.write(tf.getText(),0,tf.getText().length());
    osw.close();
    InputStreamReader isr = new
InputStreamReader(urlc.getInputStream());
 /*                     int x = isr.read(c,0,5);
     if  (x != -1)
     {
      String fin = new String(c);
      tf1.setText("The string is " + fin);
     }
     else
     {
      tf1.setText("There is a error in reading..");
                                        }*/
    isr.close();
   }
   catch(MalformedURLException mue)
   {
            System.out.println("Malformed Exception " +
mue.getMessage());
   }
   catch(IOException ioe)
   {
            System.out.println("IoException " + ioe.getMessage());
   }

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to