Socket programming in Python -- actual remote port -


I'm doing some network programming in Python these days and I want to confirm that the flow is in the middle of The client and server:

  • The server listens to a given ad port (99 99)
  • The customer connects to the server by creating a new socket (such as 1111) < / Li>
  • The server accepts the client request and automatically generates a new socket (????) which is now

    As you can see

  • There are 3 chairs included in the above flow:
    • Socket

      The first two sockets (99 99 and 1111) ) Is aware of obtaining the ports, but is not aware of receiving "real" port on the server side of the client Student communication. The snippet I am currently using:

        def sock_req Uest (t): s = socket.socket (socket.AF_INET, socket.SOCK_STREAM) s.connect (('localhost', 99 99 Print) ('local postal name:' + str (s.getsockname ()) print ('peer-sock name:' + str (satty.tv)) s.send (' A '* 1024 * int (t)) s.close ()   

      Any help on receiving a "port" number on the server, which actually communicates with the customer, a lot TIA.

      The new socket is on the same ports one TCP The connection is identified by 4 pieces: source IP and port, and destination IP and port, the fact that your server has two sockets (i.e. acceptable socket and acceptable socket) on the same port is not a problem. / P>

Comments