プロが教える店舗&オフィスのセキュリティ対策術

PEARのHTTP_Request2の設定項目に「connect_timeout」と「timeout」があるのですが、
この2つの違いを教えていただきたく質問致しました。

http://pear.php.net/manual/en/package.http.http- …

-connect_timeout
Connection timeout in seconds. Exception will be thrown if connecting to remote host takes more than this number of seconds.

-timeout
Total number of seconds a request can take. Use 0 for no limit, should be greater than connect_timeout if set. Exception will be thrown if execution of HTTP_Request2::send() takes more than this number of seconds.

例えば次のようにした場合、何をするまでが10秒で、何をするまでが20秒なのでしょうか。

$request = new HTTP_Request2('http://www.goo.ne.jp/', HTTP_Request2::METHOD_GET, array('connect_timeout' => 10, 'timeout' => 20));
try {
$res = $request->send();
} catche ...

よろしくお願い致します。

A 回答 (1件)

たとえば、


a)ファイアウォールでTCP接続要求を捨てる設定にする。
b)CGIプログラム中で、60秒間スリープする。

――とかを試してみたら、timeout設定がどういう意味なのか検証できそうな気がします。
    • good
    • 0

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!