src/Connection/PhpiredisSocketConnection.php
private function setSocketOptions($socket, ParametersInterface $parameters)
    {
        if ($parameters->scheme !== 'unix') {
            if (!socket_set_option($socket, SOL_TCP, TCP_NODELAY, 1)) {
                $this->emitSocketError();
            }

            if (!socket_set_option($socket, SOL_SOCKET, SO_REUSEADDR, 1)) {
                $this->emitSocketError();
            }
        }

        if (isset($parameters->read_write_timeout)) {
            $rwtimeout = (float) $parameters->read_write_timeout;
            $timeoutSec = floor($rwtimeout);
            $timeoutUsec = ($rwtimeout - $timeoutSec) * 1000000;

            $timeout = array(
                'sec' => $timeoutSec,
                'usec' => $timeoutUsec,
            );

            if (!socket_set_option($socket, SOL_SOCKET, SO_SNDTIMEO, $timeout)) {
                $this->emitSocketError();
            }

            if (!socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, $timeout)) {
                $this->emitSocketError();
            }
        }
    }
private function setSocketOptions($socket, ParametersInterface $parameters)
    {
        if ($parameters->scheme !== 'unix') {
            if (!socket_set_option($socket, SOL_TCP, TCP_NODELAY, 1)) {
                $this->emitSocketError();
            }

            if (!socket_set_option($socket, SOL_SOCKET, SO_REUSEADDR, 1)) {
                $this->emitSocketError();
            }
        }

        if (isset($parameters->read_write_timeout)) {
            $rwtimeout = (float) $parameters->read_write_timeout;
            $timeoutSec = floor($rwtimeout);
            $timeoutUsec = ($rwtimeout - $timeoutSec) * 1000000;

            $timeout = array(
                'sec' => $timeoutSec,
                'usec' => $timeoutUsec,
            );

            if (!socket_set_option($socket, SOL_SOCKET, SO_SNDTIMEO, $timeout)) {
                $this->emitSocketError();
            }

            if (!socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, $timeout)) {
                $this->emitSocketError();
            }
        }
    }
private function setSocketOptions ( $ socket , ParametersInterface $ parameters ) { if ( $ parameters -> scheme !== 'unix' ) { if ( ! socket_set_option ( $ socket , SOL_TCP , TCP_NODELAY , 1 ) ) { $ this -> emitSocketError ( ) ; } if ( ! socket_set_option ( $ socket , SOL_SOCKET , SO_REUSEADDR , 1 ) ) { $ this -> emitSocketError ( ) ; } } if ( isset ( $ parameters -> read_write_timeout ) ) { $ rwtimeout = ( float ) $ parameters -> read_write_timeout ; $ timeoutSec = floor ( $ rwtimeout ) ; $ timeoutUsec = ( $ rwtimeout - $ timeoutSec ) * 1000000 ; $ timeout = array ( 'sec' => $ timeoutSec , 'usec' => $ timeoutUsec , ) ; if ( ! socket_set_option ( $ socket , SOL_SOCKET , SO_SNDTIMEO , $ timeout ) ) { $ this -> emitSocketError ( ) ; } if ( ! socket_set_option ( $ socket , SOL_SOCKET , SO_RCVTIMEO , $ timeout ) ) { $ this -> emitSocketError ( ) ; } } }
Sets options on the socket resource from the connection parameters.

@param resource            $socket     Socket resource.
@param ParametersInterface $parameters Parameters used to initialize the connection.
Sets options on the socket resource from the connection parameters .