UDPFile_sender.py
def MESSAGE_file_exists(self):
        ''' This function returns byte array of full message
        to be sent as response to ~ file exists in server file system '''
        
        # Get file size
        self.file_byte_size = os.path.getsize(self.path_to_file)
        print(f"GETTING FILE SIZE OF : {self.path_to_file}... its: {os.path.getsize(self.path_to_file)}")
        

        ## Write header
        header = self.get_empty_header(header_byte_size=self.header_size)
        header[0] = ord(str(MESSAGE_TYPES['file_request_successful']))
        
        ## Write body
        body = self.get_empty_body(body_byte_size=FILE_REQUEST_SUCCESSFUL_BODY_SIZE)
        # Convert file_byte_size to string and write the values to body
        ASCII_number = str(self.file_byte_size)
        # Check if FILE_REQUEST_SUCCESSFUL_BODY_SIZE is enough
        if not len(ASCII_number) <= FILE_REQUEST_SUCCESSFUL_BODY_SIZE: 
            print("ERROR: ERROR in MESSAGE_file_exists(), file too big for body")
            return False
        for num_idx, num in enumerate(ASCII_number):
            print(f"bbbbbb: {body.shape}")
            body[num_idx] = ord(num)
        
        # Write in crc at the end of the body
        message_without_crc = np.concatenate((header, body), axis=None)
        message_with_crc = append_crc_to_message(message_without_crc)
        
        return message_with_crc
 This function returns byte array of full message
        to be sent as response to ~ file exists in server file system 
This function returns byte array of full message
to be sent as response to ~ file exists in server file system
This function returns byte array of full message to be sent as response to ~ file exists in server file system
def MESSAGE_file_exists(self):
        self.file_byte_size = os.path.getsize(self.path_to_file)
        print(f"GETTING FILE SIZE OF : {self.path_to_file}... its: {os.path.getsize(self.path_to_file)}")
        header = self.get_empty_header(header_byte_size=self.header_size)
        header[0] = ord(str(MESSAGE_TYPES['file_request_successful']))
        body = self.get_empty_body(body_byte_size=FILE_REQUEST_SUCCESSFUL_BODY_SIZE)
        ASCII_number = str(self.file_byte_size)
        if not len(ASCII_number) <= FILE_REQUEST_SUCCESSFUL_BODY_SIZE: 
            print("ERROR: ERROR in MESSAGE_file_exists(), file too big for body")
            return False
        for num_idx, num in enumerate(ASCII_number):
            print(f"bbbbbb: {body.shape}")
            body[num_idx] = ord(num)
        message_without_crc = np.concatenate((header, body), axis=None)
        message_with_crc = append_crc_to_message(message_without_crc)
        return message_with_crc
def MESSAGE_file_exists ( self ) : self . file_byte_size = os . path . getsize ( self . path_to_file ) print ( f"GETTING FILE SIZE OF : {self.path_to_file}... its: {os.path.getsize(self.path_to_file)}" ) header = self . get_empty_header ( header_byte_size = self . header_size ) header [ 0 ] = ord ( str ( MESSAGE_TYPES [ 'file_request_successful' ] ) ) body = self . get_empty_body ( body_byte_size = FILE_REQUEST_SUCCESSFUL_BODY_SIZE ) ASCII_number = str ( self . file_byte_size ) if not len ( ASCII_number ) <= FILE_REQUEST_SUCCESSFUL_BODY_SIZE : print ( "ERROR: ERROR in MESSAGE_file_exists(), file too big for body" ) return False for num_idx , num in enumerate ( ASCII_number ) : print ( f"bbbbbb: {body.shape}" ) body [ num_idx ] = ord ( num ) message_without_crc = np . concatenate ( ( header , body ) , axis = None ) message_with_crc = append_crc_to_message ( message_without_crc ) return message_with_crc
This function returns byte array of full message
to be sent as response to ~ file exists in server file system
This function returns byte array of full message to be sent as response to ~ file exists in server file system
''' This function returns byte array of full message
        to be sent as response to ~ file exists in server file system ''' # Get file size
 ## Write header
 ## Write body
 # Convert file_byte_size to string and write the values to body
 # Check if FILE_REQUEST_SUCCESSFUL_BODY_SIZE is enough
 # Write in crc at the end of the body

self