socket_set_option

(PHP 4 >= 4.3.0)

socket_set_option -- Sets socket options for the socket

Description

bool socket_set_option ( resource socket, int level, int optname, mixed optval)

警告

本扩展模块是实验性的。该模块的行为,包括其函数的名称以及其它任何关于此模块的文档可能会在没有通知的情况下随 PHP 以后的发布而改变。我们提醒您在使用本扩展模块的同时自担风险。

The socket_set_option() function sets the option specified by the optname parameter, at the protocol level specified by the level parameter, to the value pointed to by the optval parameter for the socket specified by the socket parameter. socket_set_option() will return FALSE on failure.

The level parameter specifies the protocol level at which the option resides. For example, to retrieve options at the socket level, a level parameter of SOL_SOCKET would be used. Other levels, such as TCP, can be used by specifying the protocol number of that level. Protocol numbers can be found by using the getprotobyname() function.

The available socket options are the same as those for the socket_get_option() function.

注: This function used to be called socket_setopt() prior to PHP 4.3.0