П О Р Т А Л                            
С Е Т Е В Ы Х                          
П Р О Е К Т О В                        
  
Поиск по сайту:
                                                 
Главная

О проекте

Web-мастеру
     HTML & JavaScript
     SSI
     Perl
     PHP
     XML & XSLT
     Unix Shell

MySQL

Безопасность

Хостинг

Другое








Самое читаемое:

Учебник PHP - "Для Чайника".
Просмотров 3517 раз(а).

Иллюстрированный самоучитель по созданию сайтов.
Просмотров 6118 раз(а).

Учебник HTML.
Просмотров 3274 раз(а).

Руководство по PHP5.
Просмотров 5495 раз(а).

Хостинг через призму DNS.
Просмотров 4143 раз(а).

Подборка текстов стандартных документов.
Просмотров 55772 раз(а).

Учебник PHP - Самоучитель
Просмотров 3089 раз(а).

Документация на MySQL (учебник & справочное руководство)
Просмотров 5679 раз(а).

Внешние атаки...
Просмотров 3838 раз(а).

Учебник PHP.
Просмотров 2824 раз(а).

SSI в примерах.
Просмотров 37461 раз(а).



 
 
| Добавить в избранное | Сделать стартовой | Помощь





Руководство по PHP
Пред. След.

stream_set_timeout

(PHP 4 >= 4.3.0, PHP 5)

stream_set_timeout -- Set timeout period on a stream

Description

bool stream_set_timeout ( resource stream, int seconds [, int microseconds] )

Sets the timeout value on stream, expressed in the sum of seconds and microseconds. Возвращает TRUE в случае успешного завершения или FALSE в случае возникновения ошибки.

When the stream times out, the 'timed_out' key of the array returned by stream_get_meta_data() is set to TRUE, although no error/warning is generated.

Пример 1. stream_set_timeout() example

<?php
$fp
= fsockopen("www.example.com", 80);
if (!
$fp) {
    echo
"Unable to open\n";
} else {

    
fwrite($fp, "GET / HTTP/1.0\r\n\r\n");
    
stream_set_timeout($fp, 2);
    
$res = fread($fp, 2000);

    
$info = stream_get_meta_data($fp);
    
fclose($fp);

    if (
$info['timed_out']) {
        echo
'Connection timed out!';
    } else {
        echo
$res;
    }

}
?>

Замечание: As of PHP 4.3, this function can (potentially) work on any kind of stream. In PHP 4.3, socket based streams are still the only kind supported in the PHP core, although streams from other extensions may support this function.

Замечание: This function doesn't work with advanced operations like stream_socket_recvfrom(), use stream_select() with timeout parameter instead.

This function was previously called as set_socket_timeout() and later socket_set_timeout() but this usage is deprecated.

See also fsockopen() and fopen().


Пред. Начало След.
stream_set_blocking Уровень выше stream_set_write_buffer


Если Вы не нашли что искали, то рекомендую воспользоваться поиском по сайту:
 





Copyright © 2005-2016 Project.Net.Ru