'Called when a tcp_client_id command is sent from the server
Command arguments format is:
source_port encoded_dest_ip dest_port
source_port is the source port of the connection
encoded_ip is the hex encoded output of socket.inet_pton of the destination IP
dest_port is the destination port in the connection'

def on_tcp_client_id(self, params):

    source_port = int(params[0])
    dest_ip = None
    dest_port = (-1)
    if (len(params) > 1):
        dest_ip_bytes = params[1].decode('hex')
        if (len(dest_ip_bytes) == 4):
            family = socket.AF_INET
        elif (len(dest_ip_bytes) == 16):
            family = socket.AF_INET6
        else:
            raise ValueError('Wrong    size    dest_ip')
        dest_ip = socket.inet_ntop(family, dest_ip_bytes)
    if (len(params) > 2):
        dest_port = int(params[2])
    if self.info_callback:
        applications = self.info_callback(source_port, dest_ip, dest_port)
        if applications:
            return ',    '.join((('%s    %s' % (urllib.quote(app.application), app.version)) for app in applications))
    return ''
