Can you post your current code and show us the part that is communicating via UDP. I think the way to go is deffinately make your current code stable rather than an automation of failing code.
Also what is the device you are trying to communicate with. Does this have a set protocol that you need to follow or is it one you are trying to figure out.
Let us know and we could help you further.
Matthew Trott
Applications Engineer
National Instruments UK
www.ni.com/ask