- '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
6 次查看(过去 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!