What is the question about the source port and destination port under the tcp connection?

suppose I now have a process that prints "hello world" in a loop. From a process perspective alone, will it be assigned a port number when I start it?

in other words, is the port number only available when I get the process bound, or is it randomly assigned to a port as soon as the process is started?

now leads to the second problem, let"s say I have a client process AMagi IP address is IPA, and a server process BMagee IP address is IPB. Process B actively listens (binds) the port PB, and now process A has a connection pool that points to IPB and PB. Now that process A takes 10 connections from the connection pool and sends data to process B at the same time, what is the quad of these 10 connections like?


  1. No. The operating system is not idle.
  2. this port is only available when the process is bound.
  3. IPA: [1.. 10]-> IPB:PB . Because the connection pool is initialized from the beginning, the quad will not change whether it is taken out to send data or not.

  1. when the process starts, assign the port to the port that is bound. If the port is occupied and the assignment fails, the program exits by default (exception handling flow for exception capture)
  2. after the connection is successfully established, the quaternion IPA: random port x10 <-> IPB:PB is fixed before disconnecting, and sending data does not affect the quaternion
  3. .
Menu