Gold Vision Communications / USA
 GOLDVISION.COM
Serving the Multimedia Community since 1989.
German Site | Spanish Site 

 Web Hosting

 Virtual Dedicated Servers

 Domaincheck

 Order

 Order Status

 Support

 Contact us

 Download

 Network

 Network Status

 Webdesign / Templates

 Make Payment

 Terms & Conditions

 Imprint

 Legal Notices

 Privacy Statement
  PHP / socket_set_timeout
socket_set_timeout

socket_set_timeout

(PHP 4 >= 4.0.0)

socket_set_timeout -- Set timeout period on a socket

Description

bool socket_set_timeout ( int socket descriptor, int seconds, int microseconds)

Sets the timeout value on socket descriptor, expressed in the sum of seconds and microseconds.

Example 1. socket_set_timeout() Example

<?php
$fp = fsockopen("www.php.net", 80);
if(!$fp) {
    echo "Unable to open\n";
} else {
    fputs($fp,"GET / HTTP/1.0\n\n");
    $start = time();
    socket_set_timeout($fp, 2);
    $res = fread($fp, 2000);
    var_dump(socket_get_status($fp));
    fclose($fp);
    print $res;
}
?>

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

See also: fsockopen() and fopen().


© 1998-2007 Gold Vision Communications All Rights Reserved.