downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

stream_set_read_buffer> <stream_select
[edit] Last updated: Fri, 23 Dec 2011

view this page in

stream_set_blocking

(PHP 4 >= 4.3.0, PHP 5)

stream_set_blockingAkımın engelleme kipini ayarlar

Açıklama

bool stream_set_blocking ( resource $akım , int $kip )

Belirtilen akım'ın engelleme kipini ayarlar.

Bu işlev, engellenmeyen kipi destekleyen her akımla çalışır (şimdilik, normal dosyalar ve soket akımları).

Değiştirgeler

akım

Dosya tanıtıcı.

kip

0 belirtilirse engellenmeyen kipe, 1 belirtilirse engellenen kipe geçilir. Bu, fgets() ve fread() gibi akımdan okuma yapan işlevleri etkiler. Engellenmeyen kipte bir fgets() çağrısı hemen dönerken, engellenen kipte akımdan veriyi alana kadar bekler.

Dönen Değerler

Başarı durumunda TRUE, başarısızlık durumunda FALSE döner.

Sürüm Bilgisi

Sürüm: Açıklama
4.3.0 PHP 4.3.0 öncesinde bu işlev sadece soketlere dayalı akımlarla çalışırdı.

Notlar

Bilginize:

Bu işlevin ismi başta set_socket_blocking() idi, sonradan socket_set_blocking() oldu, fakat artık bu isimlerin kullanımı önerilmiyor.

Ayrıca Bakınız

  • stream_select() - Belirtilen akım dizisi üzerinde belirtilen zaman aşımı ile select() sistem çağrısının eşdeğeri olarak çalışır


add a note add a note User Contributed Notes stream_set_blocking
MagicalTux at ookoo dot org 07-Sep-2006 05:13
When you use fwrite() on a non-blocking stream, data isn't discarded silently as t dot starling said.

Remember that fwrite() returns an int, and this int represents the amount of data really written to the stream. So, if you see that fwrite() returns less than the amount of written data, it means you'll have to call fwrite() again in the future to write the remaining amount of data.

You can use stream_select() to wait for the stream to be available for writing, then continue writing data to the stream.

Non-blocking streams are useful as you can have more than one non-blocking stream, and wait for them to be available for writing.
t dot starling at physics dot unimelb dot edu dot au 07-Sep-2005 10:02
Warning: if you write too much data to a stream in non-blocking mode and fill the buffer, the excess will be silently discarded. Observed in PHP 4.4.0 under linux.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites