Specify protocol.
Only close old fd and reassign it after being sure that the new one is ready and opened successfully.
This way, in case of failure, everything will continue to work, albeit with the old setting internally.
Complete simple UDP output.