Current location - Quotes Website - Team slogan - Socket programming to get the port number of the client
Socket programming to get the port number of the client
Because the request sent by the internal network host to the external network will pass through the router, and the router will forward it.

Such as: router public network IP188.188.188.438+088.

Your intranet IP 192 438+068 438+0.8.

If you initiate a request192.168.1.8: 8970-> opposite IP: port.

After receiving it, the router will record your intranet IP and port (establish routing table) and enable the new port to request the other party.

Actually, it may be:188.188.188.188: 6780-> the other party's IP: port.

By the way, this is called network address translation protocol, which is NAT forwarding.