socket_set_block

(PHP 4 >= 4.2.0, PHP 5)

socket_set_block --  Sets blocking mode on a socket resource

Description

bool socket_set_block ( resource socket )

The socket_set_block() function removes the O_NONBLOCK flag on the socket specified by the socket parameter.

Esempio 1. socket_set_block() example

<?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)) { // $socket is now nonblocking
    
echo socket_strerror(socket_last_error());
}

if (!
socket_set_block($socket)) {     // $socket is now blocking
    
echo socket_strerror(socket_last_error());
}

?>

Restituisce TRUE in caso di successo, FALSE in caso di fallimento.

See also socket_set_nonblock() and socket_set_option()

Hosting by: hurra.com
Generated: 2007-01-26 17:56:49