public function getOption($level, $optname)
    {
        return static::exceptionOnFalse(
            $this->resource,
            function ($resource) use ($level, $optname) {
                return @socket_get_option($resource, $level, $optname);
            }
        );
    }
public function getOption($level, $optname)
    {
        return static::exceptionOnFalse(
            $this->resource,
            function ($resource) use ($level, $optname) {
                return @socket_get_option($resource, $level, $optname);
            }
        );
    }
public function getOption ( $ level , $ optname ) { return static :: exceptionOnFalse ( $ this -> resource , function ( $ resource ) use ( $ level , $ optname ) { return @ socket_get_option ( $ resource , $ level , $ optname ) ; } ) ; }
Gets socket options.

<p>Retrieves the value for the option specified by the optname parameter for the current socket.</p>

@param int $level   <p>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 <code>SOL_SOCKET</code> would be used. Other
levels, such as <code>TCP</code>, can be used by specifying the protocol number of that level. Protocol numbers
can be found by using the <code>getprotobyname()</code> function.
@param int $optname <p><b>Available Socket Options</b></p><p><code>SO_DEBUG</code> - Reports whether debugging
information is being recorded. Returns int.</p><p><code>SO_BROADCAST</code> - Reports whether transmission of
broadcast messages is supported. Returns int.</p><p><code>SO_REUSERADDR</code> - Reports whether local addresses
can be reused. Returns int.</p><p><code>SO_KEEPALIVE</code> - Reports whether connections are kept active with
periodic transmission of messages. If the connected socket fails to respond to these messages, the connection is
broken and processes writing to that socket are notified with a SIGPIPE signal. Returns int.</p><p>
<code>SO_LINGER</code> - Reports whether the socket lingers on <code>close()</code> if data is present. By
default, when the socket is closed, it attempts to send all unsent data. In the case of a connection-oriented
socket, <code>close()</code> will wait for its peer to acknowledge the data. If <code>l_onoff</code> is non-zero
and <code>l_linger</code> is zero, all the unsent data will be discarded and RST (reset) is sent to the peer in
the case of a connection-oriented socket. On the other hand, if <code>l_onoff</code> is non-zero and
<code>l_linger</code> is non-zero, <code>close()</code> will block until all the data is sent or the time
specified in <code>l_linger</code> elapses. If the socket is non-blocking, <code>close()</code> will fail and
return an error. Returns an array with two keps: <code>l_onoff</code> and <code>l_linger</code>.</p><p>
<code>SO_OOBINLINE</code> - Reports whether the socket leaves out-of-band data inline. Returns int.</p><p>
<code>SO_SNDBUF</code> - Reports the size of the send buffer. Returns int.</p><p><code>SO_RCVBUF</code> -
Reports the size of the receive buffer. Returns int.</p><p><code>SO_ERROR</code> - Reports information about
error status and clears it. Returns int.</p><p><code>SO_TYPE</code> - Reports the socket type (e.g.
<code>SOCK_STREAM</code>). Returns int.</p><p><code>SO_DONTROUTE</code> - Reports whether outgoing messages
bypass the standard routing facilities. Returns int.</p><p><code>SO_RCVLOWAT</code> - Reports the minimum number
of bytes to process for socket input operations. Returns int.</p><p><code>SO_RCVTIMEO</code> - Reports the
timeout value for input operations. Returns an array with two keys: <code>sec</code> which is the seconds part
on the timeout value and <code>usec</code> which is the microsecond part of the timeout value.</p><p>
<code>SO_SNDTIMEO</code> - Reports the timeout value specifying the amount of time that an output function
blocks because flow control prevents data from being sent. Returns an array with two keys: <code>sec</code>
which is the seconds part on the timeout value and <code>usec</code> which is the microsecond part of the
timeout value.</p><p><code>SO_SNDLOWAT</code> - Reports the minimum number of bytes to process for socket output
operations. Returns int.</p><p><code>TCP_NODELAY</code> - Reports whether the Nagle TCP algorithm is disabled.
Returns int.</p><p><code>IP_MULTICAST_IF</code> - The outgoing interface for IPv4 multicast packets. Returns the
index of the interface (int).</p><p><code>IPV6_MULTICAST_IF</code> - The outgoing interface for IPv6 multicast
packets. Returns the same thing as <code>IP_MULTICAST_IF</code>.</p><p><code>IP_MULTICAST_LOOP</code> - The
multicast loopback policy for IPv4 packets, which determines whether multicast packets sent by this socket also
reach receivers in the same host that have joined the same multicast group on the outgoing interface used by
this socket. This is the case by default. Returns int.</p><p><code>IPV6_MULTICAST_LOOP</code> - Analogous to
<code>IP_MULTICAST_LOOP</code>, but for IPv6. Returns int.</p><p><code>IP_MULTICAST_TTL</code> - The
time-to-live of outgoing IPv4 multicast packets. This should be a value between 0 (don't leave the interface)
and 255. The default value is 1 (only the local network is reached). Returns int.</p><p>
<code>IPV6_MULTICAST_HOPS</code> - Analogous to <code>IP_MULTICAST_TTL</code>, but for IPv6 packets. The value
-1 is also accepted, meaning the route default should be used. Returns int.</p>

@throws Exception\SocketException If there was an error retrieving the option.

@return mixed See the descriptions based on the option being requested above.
Gets socket options .