UDP driver altering data

I tried the following script in the Gateway startup script:

import socket
import binascii

UDP_IP = "192.168.1.250"
UDP_PORT = 5005

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind((UDP_IP, UDP_PORT))

while True:
	data, addr = sock.recvfrom(1024)
	print "Received %s from %s" % (binascii.hexlify(data), addr)
	system.tag.write("[tags]udp_byte", data)

but my Designer now hangs when I try to save it. I’d imagine the Gateway is now thrashing non-stop at the script - is there any way of avoiding this and still running quickly enough to read each packet as it arrives?