When the server and the client establish a socket, it usually opens a new port instead of occupying 80. what is the relationship between this process and the "three-way handshake"?

web servers generally listen on port 80, but they are only used to establish connections and not to actually communicate. The connection to the real data transfer is a new temporary communication port opened after the socket.accept () step.
my question is:

  1. is the inconsistency between the listening port and the communication port correct?
  2. does this "new beginning" process have anything to do with TCP"s three-way handshake, and if so, which one comes first?
  3. which new port is used, and how does the server notify the client?
Mar.09,2021

TCP quad: source IP, destination IP, source port, destination port. This thing determines a TCP connection. When the client connects to the server, it chooses the unused port as the source port.

the connection to the real data transfer is a new temporary communication port opened after the socket.accept () step.

it is not a new temporary port, but the client selects the source port first, and then initiates a connection to shake hands. Each TCP packet has a quad, so the server knows the port used by the client.

Port 80 is not usually used for real data transmission between the server and the client

it takes a TCP quad to determine a TCP connection, so there is no case of using only port 80 or a new port to transmit. Both source and destination ports are required and no new ports will be opened.

for example, take a look at a running redis (the same for http server), listening on port 6379:

clipboard.png

the first LISTEN status is whether the ESTABLISHED behind the listening socket, is the socket of the socket,ESTABLISHED established by the client or the server or port 6379, but the client port is different.

Menu