How to python run script in background

                          I want to transfer my data from my running java application  to blender by using UDP socket protocol so so the data can be shared in  real time . but when i write blender addons's script and run it , the blender  interface is not responding.  when i check the blender system console ,the script is running and still  listening for packet to receive , but the blender UI is not responding or freeze

how can i write the addons script but not interrupt the blender interface , so when the data received my object in blender can be update in real time