Update udp.py

Minimize processing within the while loop.