Move UDP listen inside try block