socket_set_nonblock
(PHP 4 >= 4.0.7, PHP 5)
socket_set_nonblock — Attiva la modalità "nonblocking" per il descrittore di file fd
Descrizione
bool socket_set_nonblock
( resource $socket
)
Avviso
Questa funzione è SPERIMENTALE. Ovvero, il comportamento di questa funzione, il nome di questa funzione, in definitiva tutto ciò che è documentato qui può cambiare nei futuri rilasci del PHP senza preavviso. Siete avvisati, l'uso di questa funzione è a vostro rischio.
La funzione socket_set_nonblock() imposta il flag O_NONBLOCK per il socket indicato dal parametro socket .
Example#1 Esempio di uso di socket_set_nonblock()
<?php
$port = 9090;
if (!$socket = socket_create_listen($port)) {
echo socket_strerror(socket_last_error());
}
if (!socket_set_option($socket, SOL_SOCKET, SO_REUSEADDR, 1)) {
echo socket_strerror(socket_last_error());
}
if (!socket_set_nonblock($socket)) {
echo socket_strerror(socket_last_error());
}
?>
Restituisce TRUE in caso di successo, FALSE in caso di fallimento.
Vedere anche socket_set_block() e socket_set_option()