Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...

When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store


(PECL event >= 1.6.0)

EventUtil::setSocketOptionSets socket options


public static bool EventUtil::setSocketOption ( mixed $socket , int $level , int $optname , mixed $optval )

Sets socket options.



Socket resource, stream, or numeric file descriptor associated with the socket.


One of EventUtil::SOL_* constants. Specifies the protocol level at which the option resides. For example, to retrieve options at the socket level, a level parameter of EventUtil::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. See EventUtil constants .


Option name(type). Has the same meaning as corresponding parameter of socket_get_option() function. See EventUtil constants .


Accepts the same values as optval parameter of the socket_get_option() function.

Return Values

Returns TRUE on success. Otherwise FALSE.

See Also

PHP Manual