W3C home > Mailing lists > Public > www-jigsaw@w3.org > March to April 2001

RE: Setting timeout in HttpURLConnection

From: John Philip Anderson <jpanderson_215@hotmail.com>
Date: Thu, 08 Mar 2001 13:31:19 -0000
To: RonenL@gilian.com
Cc: www-jigsaw@w3.org
Message-ID: <F201eDKvPEkGhAj5p1F00002d0b@hotmail.com>
Dear Mr. Lazar,

1.)	According to the Java SE v1.3 API, Socket.setSoTimeOut(int timeout) must 
be called before that Socket is blocked for the method to have an unblocking 

2.) 	So, if you are trying to unblocked a Socket by changing its timeout 
value, I think that you are going to have find a new approach.

3.)	Frankly, I think that you should edit the HttpBasicConnection file and 
change the default value of "timeout" from 300000 to something like 30000.  
This way you can get to the heart of the matter quickly  (ripping through 
all the various levels of architecture) and hopefully ascertain that you are 
indeed on the right path.  However, I have done this myself and it did NOT 
appear to solve my problem (which appears to be similar to yours).

4.) 	Now, I am trying to write code that implements something like 
HttpManager.setRequestTimeout(int ms).

Keep posting.

John Philip Anderson

>From: Ronen Lazar <RonenL@gilian.com>
>To: 'John Philip Anderson' <jpanderson_215@hotmail.com>
>CC: www-jigsaw@w3.org
>Subject: RE: Setting timeout in HttpURLConnection
>Date: Thu, 8 Mar 2001 14:37:40 +0200
>Thank you very much for your response.
>The thing is that I'm using HttpURLConnection as the layer for managing 
>sessions. I.e. for all my needs to issue a GET request, for example, and
>receive the content.
>So in order to be able to use this class and also manage the timeout value,
>I thought maybe deriving another class from it and creating a new function
>to set it.
>So the method:
>public void setTimeout (int ms)
>	HttpManager.getManager().setTimeout (ms);
>belongs to this "MyHttpURLConnection" class.
>But I doesn't seem to do the work.
>BTW, I also tried to call HttpManager.getManager().setRequestTimeout (ms)
>with no luck here also.
>But how can I access directly the HttpBasicConnection class from
>HttpURLConnection? As far as I could understand it is not "revealed" to the
>upper level, but to lower level as HttpManager.
>While trying to check which method calls Socket.setSoTimeout (in
>HttpBasicConnection), it appears that indeed only
>HttpBasicConnection.markUsed() does that. So how can this value be changed
>_after_ the initial creation of the socket?
>Am I missing something here?
>Again, thank a lot,
>Ronen Lazar.
>-----Original Message-----
>From: John Philip Anderson [mailto:jpanderson_215@hotmail.com]
>Sent: Wednesday, March 07, 2001 8:18 PM
>To: Ronen Lazar
>Cc: www-jigsaw@w3.org
>Subject: Re: Setting timeout in HttpURLConnection
>Dear Mr. Lazar,
>	Right now, I am working through the details of Client-Side Jigsaw
>connections.  While I do not fully understand the code yet, I maybe of some
>help you.
>	I believe that the fundamental distinction between the class
>"org.w3c.www.protocol.http.HttpURLConnection", from that you proposed to
>derive, and the class "org.w3c.www.protocol.http.HttpBasicConnection" maybe
>pertinent to your question.
>	"HttpURLConnection" is associated with a specific Request/Reply
>pair.  It does not appear to independently reference the underlying socket.
>	"HttpBasicConnection" is an implementation of the abstract class
>"org.w3c.www.protocol.http.HttpConnection."  It directly creates new 
>and calls setSoTimeout() on them in the HttpBasicConnection.markUsed()
>	So to start with, you could try changing the default value for
>(from 300000 ms to whatever) directly in the HttpBasicConnection source 
>(and see if this approach solves your problem) and recompile.
>	Are you sure that the HttpManager.setTimeout() is not working?
>		Truly yours,
>		John Philip Anderson
>		jpanderson215@hotmail.com
> >From: Ronen Lazar <RonenL@gilian.com>
> >To: "'www-jigsaw@w3.org'" <www-jigsaw@w3.org>
> >Subject: Setting timeout in HttpURLConnection
> >Date: Wed, 7 Mar 2001 05:23:42 -0500 (EST)
> >
> >Hi all,
> >
> >How can I control (set) the value of the blocking timeout for a HTTP
> >request
> >in HttpURLConnection?
> >I'm looking for the effect similar to Socket.setSoTimeout (...).
> >
> >I tried to derive from the HttpURLConnection object and implement my own
> >method like:
> >
> >	public void setTimeout (int ms)
> >	{
> >		HttpManager.getManager().setTimeout (ms);
> >	}
> >
> >but it doesn't seem to do the job.
> >
> >Any idea?
> >
> >TIA,
> >Ronen.
> >
> >
>Get your FREE download of MSN Explorer at http://explorer.msn.com

Get your FREE download of MSN Explorer at http://explorer.msn.com
Received on Thursday, 8 March 2001 08:31:51 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:41:29 UTC