I would like to clarify the following regarding Connection timeout between
Web Servers and http clients.
I am using Java WebServer with the following setup for timeout
----------------------------------------------------------------
These settings affect the way the service handles TCP/IP connections.
*       Keep Alive - Sets the number of HTTP requests to allow on a single
TCP/IP connection before terminating the connection. The default is 5
requests.
*       Timeout - Sets the number of seconds before dropping an idle
connection.(Set to 1 second)
------------------------------------------------------------------
The servlet has a doPost() which reads from an ObjectInputStream , does
something using that object for 10 seconds and then writes back the output
to the ObjectOutputStream.
Since the server timeout for an idle connection is 1 second, I thought that
the connection would have been timed out during the 10 seconds that the
servlet took to
process. But it didnt.
So when is the connection deemed as idle?

Thanks,
Ranjit.
My client code is :
----------------------------------------------------------
   try
 {
            url= new URL(myurl);
            con = url.openConnection();
            con.setDoOutput(true);
            con.setDoInput(true);

con.setRequestProperty("CONTENT_TYPE","application/octet-stream");
            String toGo = getXMLString();
            System.out.println("The XML String being sent out is " +toGo);
            ObjectOutputStream os =
                new ObjectOutputStream(con.getOutputStream());

System.out.println("------------------------------------------------------")
;
                        System.out.println("Write to Server started at " +
String.valueOf(starttime));
                    starttime = System.currentTimeMillis();
            os.writeObject(toGo);
            os.flush();
            os.close();
                        endtime = System.currentTimeMillis();
                    System.out.println("closed output stream at " +
String.valueOf(endtime));
                        System.out.println("Time taken to write in
milliseconds=  " +      String.valueOf(endtime-starttime));

System.out.println("------------------------------------------------------")
;

            System.out.println("trying to receive ");

System.out.println("------------------------------------------------------")
;

                        starttime = System.currentTimeMillis();

                        System.out.println("Getting inputstream at " +
String.valueOf(starttime));
            InputStream is = con.getInputStream();
                        System.out.println("Creating Object Input Stream " +
String.valueOf(System.currentTimeMillis()));
            ObjectInputStream oi = new ObjectInputStream(is);
                System.out.println("Reading  Object " +
String.valueOf(System.currentTimeMillis()));
            Object obj_read = oi.readObject();
                        endtime = System.currentTimeMillis();
                        System.out.println("Write from Server ended  at " +
String.valueOf(endtime));
                        System.out.println("Time taken to read in
Milliseconds=  " +      String.valueOf(endtime-starttime));

System.out.println("------------------------------------------------------")
;
            String received = (String)obj_read;
            System.out.println("The XML String received is "+received);
            is.close();
            System.out.println("closed input stream");
        }
        catch (Exception ex)
        {
            String str = ex.getMessage();
            System.out.println("EXCEPTION:\n" + ex.getMessage());
            throw new RuntimeException(str);
        }
----------------------------------------------------------------------------
----

--------------------------------------------------------------------------------
The information transmitted is intended only for the person or entity to which
it is addressed and may contain confidential and/or privileged material.
Any review, retransmission, dissemination or other use of, or taking of any
action in reliance upon, this information by persons or entities other than the 
intended recipient is prohibited.
If you received this in error, please contact the sender and delete the materialfrom 
any computer.
--------------------------------------------------------------------------------

___________________________________________________________________________
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