public function getSocket()
    {
        if (is_null($this->resource)) {
            $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
            if ($socket === false) {
                throw new RequestLogException('Unable to open TCP socket: '.socket_strerror(socket_last_error()));
            }
            $success = socket_connect($socket, $this->getOption(self::OPTION_HOST), $this->getOption(self::OPTION_PORT));
            if ($success === false) {
                throw new RequestLogException('Unable to connect to host: '.socket_strerror(socket_last_error()));
            }
            $this->resource = $socket;
        }
        return $this->resource;
    }
public function getSocket()
    {
        if (is_null($this->resource)) {
            $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
            if ($socket === false) {
                throw new RequestLogException('Unable to open TCP socket: '.socket_strerror(socket_last_error()));
            }
            $success = socket_connect($socket, $this->getOption(self::OPTION_HOST), $this->getOption(self::OPTION_PORT));
            if ($success === false) {
                throw new RequestLogException('Unable to connect to host: '.socket_strerror(socket_last_error()));
            }
            $this->resource = $socket;
        }
        return $this->resource;
    }
public function getSocket ( ) { if ( is_null ( $ this -> resource ) ) { $ socket = socket_create ( AF_INET , SOCK_STREAM , SOL_TCP ) ; if ( $ socket === false ) { throw new RequestLogException ( 'Unable to open TCP socket: ' . socket_strerror ( socket_last_error ( ) ) ) ; } $ success = socket_connect ( $ socket , $ this -> getOption ( self :: OPTION_HOST ) , $ this -> getOption ( self :: OPTION_PORT ) ) ; if ( $ success === false ) { throw new RequestLogException ( 'Unable to connect to host: ' . socket_strerror ( socket_last_error ( ) ) ) ; } $ this -> resource = $ socket ; } return $ this -> resource ; }
Connect to the server and return the open socket

@return resource
@throws RequestLogException
Connect to the server and return the open socket