★ wanayoo — archive 1999 http://www.php.net/manual/fr/function.set-socket-blocking.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to Réseau
Quick Reference
English version of this pageGerman version of this pageJapanese version of this pageItalian version of this pageHungarian version of this page
Réseau
* checkdnsrr
* closelog
* debugger_off
* debugger_on
* fsockopen
* gethostbyaddr
* gethostbyname
* gethostbynamel
* getmxrr
* getprotobyname
* getprotobynumber
* getservbyname
* getservbyport
* openlog
* pfsockopen
* set_socket_blocking
* syslog
Manual: set_socket_blocking
View the source code for this pageSearch the site



Previous page
 pfsockopen
 Updated
Sun, 06 Aug 2000
syslog 
Next page


set_socket_blocking

(PHP3 , PHP4 )

set_socket_blocking -- Active/desactive le mode bloquant d'une socket.

Description

int set_socket_blocking (int socket descriptor, int mode)

Si mode est FALSE, la socket est mise en mode non bloquant, et si il est TRUE, la socket est mise en mode bloquant. Cela affecte des appels tels que fgets() qui lisent depuis une socket. En mode non bloquant, un appel fgets() retournera immediatement toujours TRUE tandis qu'en mode bloquant, elle va attendre que des données arrivent pour répondre TRUE.


User Contributed Notes: set_socket_blocking


chopin@csone.kaist.ac.kr
07-Oct-1999 02:51
set_socket_blocking() has bug up to php4beta2 release. It will stall php script in fgets() or fread() always.
you must get newest cvs version for correct version.

<a href=/old?u=http%3A%2F%2Fwww.php.net%2Fmanual%2Ffr%2F%26quot%3Bhttp%3A%2Fbugs.php.net%2Fbugs.php3%3Fid%3D2039%26amp%3Bedit%3D1%26quot%3B%26gt%3B&y=1999 bug report and fixed</a>



ewdafa@ewdafa.b0rk.co.uk
06-May-2000 05:52
be careful, when you set non_socket_blocking and then have a loop checking to see if the socket has data, php will chew up almost all of your CPU time. set_socket_blocking($socket,1) it was using 0.1% cpu, with set_socket_blocking($socket,0) php was using 85-95% cpu. anyone have a work around for this? id like to be able to read from multiple sockets at the same time.



jordanh@remotepoint.com
21-May-2000 05:32
Sounds like what we really need is a PHP-ized select() call, or an ability to timeout blocking reads.


dschultz@protonic.com
01-Jul-2000 07:24
To avoid the excessive CPU usage in the loop, try sticking a sleep() or usleep() in there.


olli.holliday@redhotant.com
03-Jul-2000 06:40
after a *lot* of fiddling, im fairly confident that fgets() etc. block even on a supposedly non-blocking socket in win32.
i've tried php3 (latest), php4 and the new php4 patch and i have the same problem on them all.

can anybody confirm this?



 About Notes


Previous page
 pfsockopen
 Updated
Sun, 06 Aug 2000
syslog 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
United States
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.