More robust host or IP determination