socket_get_option
socket_get_option
Gets socket options for the socket
**socket_get_option** Socket $socket int $level int $option
The function retrieves the value for
the option specified by the parameter for the
specified .
socket_get_option``option``socket
socket
A instance created with
or .
Socket``socket_create``socket_accept
level
The parameter specifies the protocol
level at which the option resides. For example, to retrieve options at
the socket level, a parameter of
would be used. Other levels, such as
, can be used by
specifying the protocol number of that level. Protocol numbers can be
found by using the function.
level``level``SOL_SOCKET``TCP``getprotobyname
option
Returns the value of the given option, return.falseforfailure.
Voorbeeld: example
<?php
$socket = socket_create_listen(1223);
$linger = array('l_linger' => 1, 'l_onoff' => 1);
socket_set_option($socket, SOL_SOCKET, SO_LINGER, $linger);
var_dump(socket_get_option($socket, SOL_SOCKET, SO_REUSEADDR));
?>
socket_create_listen``socket_set_option