4

さて、質問のタイトルは非常に自明だと思うので、おそらく読み続ける必要はありませんが、ここに続きます:

私はしばらくPyCurlを使用してきましたが、常に次を使用してタイムアウトを設定してきました

curlConnector = pycurl.Curl()
curlConnector.setopt(pycurl.CONNECTTIMEOUT, 30)

しかし、デフォルトのタイムアウトとは何か、またはそれを見つける方法について疑問に思い始めましたが、これまでのところ満足のいく答えはありません..手動で指定しない場合、デフォルトのタイムアウトは何ですか? ソケットから何が来ますか?(念のため、Ubuntu 12.04 と python2.7 で作業しています)

4

1 に答える 1

6

PyCurl をダウンロードしました。doc/tarballのディレクトリには、いくつかの doc ファイルがあります。そのうちの 1 つが でdoc/curlobject.htmlsetup「libcurl の curl_easy_setopt に対応」と書かれています。そのリンクをたどるとhttp://curl.haxx.se/libcurl/c/curl_easy_setopt.htmlに移動し、「CONNECTTIMEOUT」を検索すると次のように表示されます。

CURLOPT_CONNECTTIMEOUT

Pass a long. It should contain the maximum time in seconds that you allow the connection to the server to take. 
This only limits the connection phase, once it has connected, this option is of no more use. 
Set to zero to switch to the default built-in connection timeout - 300 seconds. 
See also the CURLOPT_TIMEOUT option.

したがって、デフォルトのタイムアウトは 300 秒です。

于 2013-02-07T19:05:36.633 に答える