PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<socket_set_blocksocket_set_option>
Last updated: Mon, 16 Jul 2012

socket_set_nonblock

(PHP 4 >= 4.1.0, PHP 5)

socket_set_nonblock -- Sets nonblocking mode for file descriptor fd

Description

bool socket_set_nonblock ( resource socket )

The socket_set_nonblock() function sets the O_NONBLOCK flag on the socket specified by the socket parameter.

例子 1. socket_set_nonblock() 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)) {
   echo
socket_strerror(socket_last_error());
}
?>

如果成功则返回 TRUE,失败则返回 FALSE

See also socket_set_block() and socket_set_option()




<socket_set_blocksocket_set_option>
 Last updated: Mon, 16 Jul 2012
 
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://manual.phpv.net/
Last updated: Thu Jul 7 19:13:47 2005 CST