Thread Subject: urlread timeout

Subject: urlread timeout

From: Michele

Date: 2 Mar, 2008 01:45:04

Message: 1 of 6

urlread has a serious problem, at least in R13, in that if
the url you're trying to read doesn't answer, urlread just
hangs without returning an error. In fact the only way to
regain control is to open the process manager and kill Matlab.

I tried Fu-Sung Wang's urlread2 which claims to fix this but
it generates the following error:

img = urlread2('http://192.168.0.107/image.jpg', [], [], 5);
??? Undefined variable 'com' or class
'com.mathworks.mlwidgets.html.HTMLPrefs.setProxySettings'.

Error in ==> C:\matlab\toolbox\matlab\iofun\urlread2.m
On line 41 ==>
com.mathworks.mlwidgets.html.HTMLPrefs.setProxySettings

I tried saying

com.mathworks.services.Prefs.setStringPref('HelpSelectedProducts','MATLAB');

and then restarting Matlab as suggested in another post, but
that had no effect.

The author isn't answering his email and I'm really stuck.
Does anyone have a way to read web pages without hanging if
the url is down? Any help would be greatly appreciated.
Thanks.

Subject: urlread timeout

From: Michele

Date: 29 Jul, 2008 17:27:02

Message: 2 of 6

Nothing? No one else has this problem? Anyone? I could
still use some help with this one. Thanks.

Subject: urlread timeout

From: Peter Boettcher

Date: 29 Jul, 2008 17:50:43

Message: 3 of 6

"Michele " <denber.nospam@mindspringNOSPAM.com> writes:

> Nothing? No one else has this problem? Anyone? I could
> still use some help with this one. Thanks.

On USENET, your previous post isn't here, so we don't have access to
it. But I gather you want urlread to timeout gracefully.


urlread uses a Java class to do the connection. "edit urlread" and
"edit urlreadwrite" for the code. Without knowing much about it, the
urlConnection object which is returned by urlreadwrite and used at the
end of urlread has a method "getReadTimeout", "getConnectTimeout", and
corresponding "set" methods. I bet if you modify urlread.m (I would
make yourself a local copy of it, on your MATLAB path, to avoid toolbox
and hashing issues) to set appropriate timeouts for these, things would
work nicely. You might call your copy urlread_with_timeout.m

-Peter

Subject: urlread timeout

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 29 Jul, 2008 19:01:55

Message: 4 of 6

In article <muyfxps1swc.fsf@G99-Boettcher.llan.ll.mit.edu>,
Peter Boettcher <boettcher@ll.mit.edu> wrote:
>"Michele " <denber.nospam@mindspringNOSPAM.com> writes:
>
>> Nothing? No one else has this problem? Anyone? I could
>> still use some help with this one. Thanks.

>On USENET, your previous post isn't here, so we don't have access to
>it.

Amendment: the post had expired at your location, since it was
from the beginning of March.
--
  "The beauties of conception are always superior to those of
   expression." -- Walter J. Phillips

Subject: urlread timeout

From: Michele

Date: 7 Sep, 2008 21:25:04

Message: 5 of 6

Peter Boettcher <boettcher@ll.mit.edu> wrote in message <muyfxps1swc.fsf@G99-Boettcher.llan.ll.mit.edu>...

> Without knowing much about it, the
> urlConnection object which is returned by urlreadwrite and used at the
> end of urlread has a method "getReadTimeout", "getConnectTimeout", and
> corresponding "set" methods.

Thanks for the reply. Uunfortunately I can't get mine to do that. I get this:

>> urlConnection.getReadTimeout
??? No appropriate method or public field getReadTimeout for class sun.net.www.protocol.http.HttpURLConnection.

I get the same error when trying setReadTimeout.

The Sun website Java documentation for urlConnection also does not list these Timeouts. Is this just not in V6R13 or am I missing something here? Anyway, this doesn't work for me.

Any other ideas for preventing an unresponsive server from hanging your Matlab session? Thanks.

Subject: urlread timeout

From: bwd

Date: 15 Feb, 2009 20:05:03

Message: 6 of 6

I struggled with this for a while, until I realized that the timeout time is in milliseconds:
urlConnection.setReadTimeout(5000); % timeout in 5 seconds

I added this on line 96 or urlread.m (R2006b) and it works.
dave

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
getreadtimeout Michele 7 Sep, 2008 17:30:22
urlconnection Michele 7 Sep, 2008 17:30:22
timeout Michele 1 Mar, 2008 20:50:05
urlread2 Michele 1 Mar, 2008 20:50:05
urlread Michele 1 Mar, 2008 20:50:05
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com