public function scanPortRange() {
        if (strtolower($this->typePort) == 'tcp') {
            $hostIp = $this->hostIP;
        } else if (strtolower($this->typePort) == 'udp') {
            $hostIp = "udp://$this->hostIP";
        } else {
            throw new \Exception('Port Type undefined!');
        }

        $errno = $errstr = null;
        for ($portNumber = $this->startPort; $portNumber <= $this->endPort; $portNumber++) {
            $handle = @fsockopen($hostIp, $portNumber, $errno, $errstr, $this->timeout);
            if ($handle) {
                $service = $this->getService($portNumber, strtolower($this->typePort));
                $this->openPorts[$portNumber] = (!empty($service)) ? $service : null;
                fclose($handle);
            }
        }
        return $this->openPorts;
    }