"timeout" setting not work in webread function
显示 更早的评论
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
回答(1 个)
Debadipto
2024-9-16
0 个投票
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
类别
在 帮助中心 和 File Exchange 中查找有关 Web Services 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!