- 'http://dummy' triggers a DNS lookup, which fails slowly (up to 30 seconds), especially if the domain doesn’t exist.
- The 'Timeout' value (even if set to 1 second) is ignored during DNS resolution.
specifying 'Timeout' in weboptions does not work
조회 수: 5 (최근 30일)
이전 댓글 표시
Hi all!
I want have a 1 sec. timeout in my call to webwrite(). However, this code takes 30 sec. to execute before throwing an error.
webwrite('http://dummy', 'blah', weboptions('Timeout', 1))
What is even more weird, is that the call to "weboptions" without arguments shows that the default is 5 sec. (returns "Timeout: 5")
I am running Matlab 2015a, on OS X 10.10
Any idea, what could be the problem?
댓글 수: 0
답변 (1개)
Rahul
2025년 6월 24일
I understand that you wish to set a 1 second timeout before throwing an error while using 'webwrite' for the dummy url. You are experiencing a delay of 30 seconds before the error is being thrown.
The following behaviour is observed because:
As a workaround to test the 1 second timeout, consider using a non-routable IP address. This would bypass the DNS step and trigger the TCP timeout.
Here is an exmple:
webwrite('http://10.255.255.1', 'blah', weboptions('Timeout', 1));
The following MathWorks documentations can be referred:
Thanks.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!