import socket import structlog import threading def send_adif_qso_data(config, event_manager, adif_data): """ Sends ADIF QSO data to the specified server via UDP in a non-blocking manner. Parameters: config (dict): Configuration settings. event_manager: An event manager to log success/failure. adif_data (str): ADIF-formatted QSO data. """ log = structlog.get_logger() # Check if ADIF UDP logging is enabled adif = config['QSO_LOGGING'].get('enable_adif_udp', 'False') if not adif: return # Exit if ADIF UDP logging is disabled adif_log_host = config['QSO_LOGGING'].get('adif_udp_host', '127.0.0.1') adif_log_port = int(config['QSO_LOGGING'].get('adif_udp_port', '2237')) def send_thread(): sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # Set a timeout of 3 seconds to avoid blocking indefinitely sock.settimeout(3) callsign_start = adif_data.find(f">") + 1 callsign_end = adif_data.find(f"