I have a misundertanding about some networking theory and because I couldn't find a definitive answer online (most resourceas are theory and theory etc without concise examples) I'm asking here.
Assuming I have a server with IP 10.10.10.10
that listens on port 80 and two clients with IP 20.20.20.20
and IP 30.30.30.30
respectivelly, when both clients connect to the server on port 80, what happens?
Does it...
A. server accepts connection on port 80 for both clients and creates two sokets:
server IP: 10.10.10.10
server port: 80
client IP: 20.20.20.20
client port: whatever port client 1 used to connect
and
server IP: 10.10.10.10
server port: 80
client IP: 30.30.30.30
client port: whatever port client 2 used to connect
then when new packets arrive on port 80 from the clients they get dispatched to the appropriate socket based on the client IP and port?
Or...
B. server only accepts connections on port 80 and alocates other ports for communication with clients as the clients connect? So now we still have two sockets created but like this:
server IP: 10.10.10.10
server port: random free port
client IP: 20.20.20.20
client port: whatever port client 1 used to connect
and
server IP: 10.10.10.10
server port: another random free port
client IP: 30.30.30.30
client port: whatever port client 2 used to connect
while port 80 remains free to accept other connections?
So which is it?
I'm sorry if the question sounds stupid or newbish but I found both mentioned online and they can't both be true. I'm thinking others have the same confusion and a clear and concice answer here might be very helpful.