Add error handling to UDP connection