This article is a mirror article of machine translation, please click here to jump to the original article.

View: 10988|Reply: 0

Successfully performed a UDP hole [Reprint]

[Copy link]
Posted on 3/8/2017 2:36:44 PM | | | |
Parameters of this test:
The server is a fixed IP on the public network. Two clients, A and B, are located behind different computers, different broadband, and different models of routing (one home route, one enterprise route), and the routes are not specially configured.
There is nothing special about the test, just the experiment according to the online data. As shown below:
Illustrate:
When the A side sends a packet to the server using UDP, the server side gets the IP and port of the A end: xxx.xxx.xxx.101:5841
When the B side sends a packet to the server using UDP, the server side gets the IP and port from the B side: xxx.xxx.xxx.105:12584
At this time, the routing at both ends of A and B is equivalent to opening a channel to communicate with A and B outward. Not only can the server communicate with A and B, but since the channel is open, then:
A can send a message directly to the channel that B has opened (B=xxx.xxx.xxx.105:12584).
Same:
B can also send a message directly to a channel A has opened (A=xxx.xxx.xxx.101:5841).
Note: There seems to be a sequence of communication between A and B, I forgot~, just send it anyway
Finally: UDP communication is a bit more "sensitive" than TCP in some cases (maybe a bit off, and I don't know how to describe it).
For example, sometimes the broadband has been dialed successfully, but TCP cannot connect to the server, and the browser opens the web page, and it takes a long time for TCP to communicate normally.
While during the period when TCP cannot be connected, UDP is normal.
But using UDP is definitely not a hassle-free task:
--A reasonable package protocol needs to be designed
--If the information integrity is required, it needs to be retransmitted
--High adaptability requirements need to be used with TCP
The current network environment is relatively good, and the success rate of UDP sending can reach 98, 99%, or even higher (I didn't do enough testing, I just feel it).
In the complex and unstable network environment at that time, QQ actually chose UDP as the main communication protocol, while ICQ and MSN at the same time were mainly TCP.
Imitation does not mean following and falling behind, but is important to be able to inject new thinking under an old framework. This should also be one of the inevitable factors for the horse's success.





Previous:.net/c# UDP communication gadget [source code]
Next:[Actual combat] UDP System.Net.Sockets.SocketException
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com