'First, check for the version string (SSH-2.0-*).  After that has been
received, this method adds data to the buffer, and pulls out any
packets.
@type data: L{bytes}
@param data: The data that was received.'

def dataReceived(self, data):

    self.buf = (self.buf + data)
    if (not self.gotVersion):
        if (self.buf.find('\n', self.buf.find('SSH-')) == (-1)):
            return
        lines = self.buf.split('\n')
        for p in lines:
            if p.startswith('SSH-'):
                self.gotVersion = True
                self.otherVersionString = p.strip()
                remoteVersion = p.split('-')[1]
                if (remoteVersion not in self.supportedVersions):
                    self._unsupportedVersionReceived(remoteVersion)
                    return
                i = lines.index(p)
                self.buf = '\n'.join(lines[(i + 1):])
    packet = self.getPacket()
    while packet:
        messageNum = ord(packet[0:1])
        self.dispatchMessage(messageNum, packet[1:])
        packet = self.getPacket()
