"timeout" setting not work in webread function

조회 수: 10 (최근 30일)
Yu Li
Yu Li 2024년 9월 13일
답변: Debadipto 2024년 9월 16일
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
Debadipto 2024년 9월 16일
Hi @Yu,
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

카테고리

Help CenterFile Exchange에서 Web Services에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by