I am checking the incoming data by reading continuously in while true in a separate thread. I don\'t want it to work constantly. Is there a function that will only be triggered