You can use the same code on both ends if you modify one.
You can use UDP on a localnet without an internet connection.