How to check if there are any packets in the transmission queue
Hi! I am currently writing a program to measure the maximum data transfer rate between two LoRa nodes using LoRa RAW. One of the problems I've encountered is an error message: "OSError: [Errno 11] EAGAIN", when trying to send several packages in short amount of time.
I know this is related to duty cycle limiting, which means that I need to implement a functionality where the program checks if there are any packets in the transmission queue before it starts transmitting. I do not want to use a hardcoded timer between each transmission, as this would impact the results.
My question is if anybody out there has any idea on how to solve this problem, so the program itself can determine when to send the next package?
This post is deleted!
Thanks for the answer. I already tried using callbacks, but couldn't quite figure it out. Luckily, i managed to find some piece of code on the web which seems to check if there are any data in the socket.
# Check if the socket is busy r, w, x = select.select([tx], [tx], , 0) if r or w: tx.send(package)
Where tx is the name of the socket.
@keik Haven't looked into that for ages, but IIRC the behaviour changes depending on some settings of the socket, like blocking or something similar.
Also you can use callbacks to be notified when TX is done (or has failed).