def collect_tcp(self, uri):
        parsed = self.parse_url(uri)
        try:
            host, port = parsed.netloc.split(':')
            port = int(port)
        except __HOLE__:
            self.log.error('OpenVPN expected host:port in URI, got "%s"',
                           parsed.netloc)
            return

        if '?' in parsed.path:
            name = parsed.path[1:]
        else:
            name = host.replace('.', '_')

        self.log.info('OpenVPN parsing "%s" tcp: %s:%d', name, host, port)

        try:
            server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            server.settimeout(int(self.config['timeout']))
            server.connect((host, port))

            fd = server.makefile('rb')
            line = fd.readline()
            if not line.startswith('>INFO:OpenVPN'):
                self.log.debug('OpenVPN received: %s', line.rstrip())
                self.log.error('OpenVPN protocol error')
                server.close()
                return

            server.send('status\r\n')

            lines = []
            while True:
                line = fd.readline()
                lines.append(line)
                if line.strip() == 'END':
                    break

            # Hand over data to the parser
            self.parse(name, lines)

            # Bye
            server.close()

        except socket.error, e:
            self.log.error('OpenVPN management connection error: %s', e)
            return
dataset/ETHPy150Open BrightcoveOS/Diamond/src/collectors/openvpn/openvpn.py/OpenVPNCollector.collect_tcp