Socket for 6DOF tracking

Hi I have this problem: I try to read a matrix coordinate send me to my tracking system.
I want to se the object move in the window of blender and i have make this using a socket UDP and apply every time the matrix on the object.But my socket is in while(true) for reading every time the string and i cant navigate the scene during script run.

I have try with thread but with no result.Because i must don’t close the script that generate the thread and my blender windows is blocked.

Any idea??