"timeout" setting not work in webread function
12 views (last 30 days)
Show older comments
Hi:
I use parallel loop to grab data using "webread" , I set up the timeout option to be 10 seconds,
options = weboptions;
options.Timeout = 10;
then use command like below:
timeCost=[];
parfor i=1:1:1e4
tic
webReadTmp=webread(command,options);
timeCost(i)=toc;
end
I use "timeCost" variable to record the time needed for each webread operation. however I notice there are some webread cost more than 30 second, which means the "timeout" setting is not working here.
is there any mistake with my command?
Thanks!
Yu
0 Comments
Answers (1)
Debadipto
on 16 Sep 2024
The "Timeout" setting here specifies the maximum duration to wait for an initial response from the server after sending a request, not an estimate of how long it will take to receive the full response. If the server responds within the timeout duration, you will receive the response; otherwise, a timeout error occurs. It is a safeguard to prevent waiting indefinitely for a response.
In summary, the timeout does not estimate the response time but sets a limit on how long you are willing to wait for a response.
For the definition of "Timeout", please refer to the following MATLAB documentation:
https://www.mathworks.com/help/matlab/ref/weboptions.html#:~:text=Timeout%20%E2%80%94%20Time%20out%20connection%20duration
0 Comments
See Also
Categories
Find more on Web Services in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!