Optimize udp thread