- 要控制 timeout,應該使用的是
RequestConfig
裡的connectTimeout
,而不是responseTimeout
。 responseTimeout
從原始碼來看,跟socketTimeout
是差不多的東西。socketTimeout
代表的意思是距離上一次 network I/O 的時間差。也就是說,如果設定socketTimeout
為n
ms,則每n-1
ms 收到一個封包,也是不會觸發 timeout 的。
Software entities (class, modules, functions, etc.) should be open for extension, but closed for modification.
- Bertrand Meyer
Junior programmers create simple solutions to simple problems. Senior programmers create complex solutions to complex problems. Great programmers find simple solutions to complex problems.
- Charles Connell
註1:本部落格的範例程式碼在 2015 年以前的文章中,大多是以全型空白做縮排。如需服用,請自行用文字編輯器的取代功能把全型空白取代成半型空白。
註2:本部落格的內容授權請參閱部落格底部的授權宣告。
2024年11月26日 星期二
[筆記] Apache HTTP Client 5 的注意事項
訂閱:
文章 (Atom)