Quote: ""Local", then mean this command work only in local?"
Ports are always Local., as they are an "Endpoint"
A good way to look at it is, you know how when you phone a business; each person / department doesn't have a unique phone number., instead they have an Extension.
Well that's basically what a Port is.
So say you call IP 168.192.0.1:80... this is basically saying "I want to connect to this Device, and I want to talk to the Internet"., if we used 168.192.0.1:443 you're basically saying you want a Secure Line to the Internet.
Now in general terms there 0 - 65535 Ports, but Ports up to 1024 are "Pre-Registered"; meaning they are either assigned to specific services OR are reserved for future "Common" Services.
This means in reality we can only use 1025 - 65535 for whatever we want, such-as Game Services.
Now for UDP to work over a Network you must supply an IP to an external machine and a valid (open) Port
I'd recommend Port 4000 - 5000... and remember you DO want to use a Range., because you'll likely want to run Multiple Game Server Instances on a Single Server.
As a further note MOST Internet Services Provides do not yet support or provide IPv6; where-as this has been commonly supported over LAN / WiFi for the past 15 years.
So it's highly recommended to use IPv4 instead.
•
Now beyond this UDP and TCP (Sockets) work slightly differently to each other.
TCP will create a Direct Connection., with Network Messages handled with Authentication and in FIFO Order.
UDP will create an Open Connection., with Network Messages handled on a send-and-forget in the order YOU send them in... on top of this there are no checks to make sure they're received.
Typically speaking UDP is great for Low-Latency Scenarios., as you're just sending the Network Messages whenever you want and hoping someone is listening for them.
TCP on the other hand is great for Guaranteed Data, like say sending a File.
Now you can use both for Game Servers., and typically you'll actually use a Hybrid of Both; where Real-Time Data (Player Position, Are They Doing an Action, etc.) is via UDP; while Game Chat, Inventory Access, etc. is handled via TCP.