I didn't see the examples, but for sure work over a LAN is normally more simple that work over a WAN.
You cannot simply trasmitt a network packet when there ia a "filter" on the network, like all the WAN have.
Those include firewall, router, managed switch, vlan, vpn, etc ...
So, without a server (thinking as a service server) is difficoult make such things in general.
Insetad if you can have a WAN with open and NAT ports (really, no one administrator permits to have that), the LAN and WAN is near the same and you can do what you want.
I use Indy in Delphi and it was really simple to do what you want and perhaps the examples (that were presented from evaluable member of this forum) are goods too with Synapseor others.
Remember that, in this era, all comunications should be protected and so you should (MUST ?) implement SSL comunications (... TLS technically) or other means to encrypt and secure the comunications.