andouconfectionery

andouconfectionery t1_j1yweo1 wrote

Port numbers are used to distinguish TCP connections between two IP addresses. Without this extra number, you could only have one connection between any two IP addresses at one time. They can take any value between 0 and 65535.

The computer you're connecting to may have a Terraria server and a Minecraft server running on it at the same time. You need to specify the destination port number so the game traffic knows where to go once it gets to that computer.

In addition, your computer assigns a source port number to that connection. This is in case you also have Minecraft running and connect to that same computer. When you get data back, it'll send that data to the right program on your computer based on the source port.

1