Say I have a server, and multiple clients. Each client (same or different LAN) opens a program which connects to the server. I'm not sure how to ask my question, so I'll just write what I'm trying to do:

(theoretical example)

Server constantly listens for connection on port 2000.
Server's public IP is 111.111.1.111
Server's LAN IP is 1.1.1.5


Would the following be a correct flow? (Please correct, I have little to no understanding of this part)

3 clients, under the same public ip 123.123.123.123
whose LAN ip's are:
192.168.1.10
192.168.1.11
192.168.1.12

So the first question arises: does each of these clients need to use a different port?

Let's say they each open a different port
192.168.1.10:101
192.168.1.11:102
192.168.1.12:103

The data then goes to their router. Would the data going out look like this?
123.123.123.123:101
123.123.123.123:102
123.123.123.123:103

If so, when it reaches the server, is the following correct?
Data is received on the server's router's ports 101, 102, 103
The router then forwards ALL THREE ports to the server's LAN ip, port 2000 (1.1.1.5:2000)

The server now has a valid connection?

I don't know that you should need to open any ports.
Is there a reason you aren't using private IP addresses in the LAN?
You'll have to search for the exact ranges but they're around:
10.0.0.1-10.255.0.0
172.0..0 whatever something
192.168.0.0-192.168.255.255,learn subnetting if you need to

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.