UDPFile_receiver.py
def parse_file_hash_response(self, data):
        ''' Parse received file hash message from receiver application '''

        header, body = self.parse_data(data)
        ret_dict = {}

        # NET DERPER CHANGES FIRST NUM TO CHAR
        if not str(chr(header[0])).isnumeric():
            ret_dict["return"] = PARSE_RETURNS["wrong_message_type"]
            return ret_dict

        message_type = int(str(chr(header[0])))
        if ord(chr(message_type)) != MESSAGE_TYPES['file_hash']: 
            print(f'ERROR in parse_file_hash_response(): Message type {ord(chr(message_type))} doesn\'t match {MESSAGE_TYPES["file_hash"]}')
            ret_dict["return"] = PARSE_RETURNS["wrong_message_type"]
            return ret_dict

        # Check CRC
        if not check_crc_received_message(data):
            ret_dict["return"] = PARSE_RETURNS["wrong_crc"]
            return ret_dict

        hash = data[HEADER_SIZE:HEADER_SIZE+HASH_LENGTH]
        ret_dict["return"] = PARSE_RETURNS["request_successful"]
        ret_dict["hash"] = hash
        return ret_dict
 Parse received file hash message from receiver application 
Parse received file hash message from receiver application
Parse received file hash message from receiver application
def parse_file_hash_response(self, data):
        header, body = self.parse_data(data)
        ret_dict = {}
        if not str(chr(header[0])).isnumeric():
            ret_dict["return"] = PARSE_RETURNS["wrong_message_type"]
            return ret_dict
        message_type = int(str(chr(header[0])))
        if ord(chr(message_type)) != MESSAGE_TYPES['file_hash']: 
            print(f'ERROR in parse_file_hash_response(): Message type {ord(chr(message_type))} doesn\'t match {MESSAGE_TYPES["file_hash"]}')
            ret_dict["return"] = PARSE_RETURNS["wrong_message_type"]
            return ret_dict
        if not check_crc_received_message(data):
            ret_dict["return"] = PARSE_RETURNS["wrong_crc"]
            return ret_dict
        hash = data[HEADER_SIZE:HEADER_SIZE+HASH_LENGTH]
        ret_dict["return"] = PARSE_RETURNS["request_successful"]
        ret_dict["hash"] = hash
        return ret_dict
def parse_file_hash_response ( self , data ) : header , body = self . parse_data ( data ) ret_dict = { } if not str ( chr ( header [ 0 ] ) ) . isnumeric ( ) : ret_dict [ "return" ] = PARSE_RETURNS [ "wrong_message_type" ] return ret_dict message_type = int ( str ( chr ( header [ 0 ] ) ) ) if ord ( chr ( message_type ) ) != MESSAGE_TYPES [ 'file_hash' ] : print ( f'ERROR in parse_file_hash_response(): Message type {ord(chr(message_type))} doesn\'t match {MESSAGE_TYPES["file_hash"]}' ) ret_dict [ "return" ] = PARSE_RETURNS [ "wrong_message_type" ] return ret_dict if not check_crc_received_message ( data ) : ret_dict [ "return" ] = PARSE_RETURNS [ "wrong_crc" ] return ret_dict hash = data [ HEADER_SIZE : HEADER_SIZE + HASH_LENGTH ] ret_dict [ "return" ] = PARSE_RETURNS [ "request_successful" ] ret_dict [ "hash" ] = hash return ret_dict
Parse received file hash message from receiver application
Parse received file hash message from receiver application
''' Parse received file hash message from receiver application ''' # NET DERPER CHANGES FIRST NUM TO CHAR
 # Check CRC

self
data