fopen ile sunucumdaki bulunan ffserver'de aktif olup ama icerigi olmayan bir dosyayi acmak istedigimde 503 Bad Gateway aliyorum. (Script hic sonu bulmuyor sürekli calisiyor) Aktif olup ve icerigi olan dosyada herhangi bir sorun yok.
ffserverin sundugu linkler herzaman acik yani sundugu dosyanin icerigi olmadigi halde HTTP 200 kodunu aliyorum ve sanirim bu nedenle timeout islemini yapmiyor.
Bu icerigi olmayan dosyalarda timeout islemini nasil aktif edebilirim veya nasil kontrol edebilirim? php sayfasinda arasdirdim fakat birsey bulamadim
Kullandigim script:
$context = stream_context_create( array( 'http' => array( 'timeout' => 3.0 ) ) );
$url = "http://localhost:8090/stream.ts";
$file_handler = fopen( $url, "rb", false, $context ) or exit( "Stream Not Working" );
foreach ( $http_response_header as $h ) {
header( $h );
}
while ( ! feof( $file_handler ) && ClientConnected() ) {
if ( $client_allowed_bandwidth != 0 and $bytes > $client_allowed_bandwidth ) {
break;
}
$response = stream_get_line( $file_handler, 8192 );
$bytes += strlen( $response );
//Freezing Problem-> Fix this Problem...
//mysql_query("UPDATE `clients` SET `client_used_bandwidth`= '$bytes' WHERE `client_username` = '$user'");
echo $response;
}
}
@fclose( $file_handler );