⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 t-firewall.htm

📁 udt的一个源代码
💻 HTM
字号:
<html><head><meta http-equiv="Content-Language" content="en-us"><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><title>UDT Reference</title></head><body><table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" id="table1" bgcolor="#99CCFF" bordercolor="#99CCFF">  <tr>    <td width="100%"><font face="Verdana" size="2"><i>&nbsp;UDT </i></font><i>	<font face="Verdana" size="2">Tutorial</font></i></td>  </tr></table><h1><font face="Verdana" size="4">Rendezvous Connection and Firewalls</font></h1><p><font face="Verdana" size="2">While UDT was originally written for extremelyhigh speed data transfer, there are many other potential benefits from thisreliable UDP-based library. One particular usage is to setup reliableconnections between machines behind firewalls, especially those NAT firewall. Tomeet this requirement, UDT has added the rendezvous connection setup support.</font></p><p><font face="Verdana" size="2">Traditional BSD socket setup process requiresexplicit server side and client side. To punch NAT firewalls, a common method isto use the SO_REUSEADDR socket option to open two sockets bound to the sameport, one listens and the other connects. UDT provides the more convenientrendezvous connection setup, in which there is no server or client, and twousers can connect to each other directly.</font></p><p><font face="Verdana" size="2">Inside the UDT implementation of the rendezvousconnection setup, each UDT socket sends connection request to its peer side, andwhoever receives the request will then send back response and set up theconnection.</font></p><p><font face="Verdana" size="2">An example is shown below.&nbsp;Each UDT socketmust bind to a known address and then try to connect to peer side's knownaddress. After the connect call is returned, the UDT connection is set up.</font></p><font face="Verdana" size="2"><p style="margin-top: 0; margin-bottom: 0"><b>Example: rendezvous connectionsetup</b></p><p style="margin-top: 0; margin-bottom: 0">&nbsp;</p><table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" id="table2" bgcolor="#C0C0C0" bordercolor="#C0C0C0">  <tr>    <td width="100%">    <p style="margin-top: 0; margin-bottom: 0">    <font size="1" face="Courier New">UDTSOCKET u;</font></p>	<p style="margin-top: 0; margin-bottom: 0">    <font face="Courier New" size="1">...</font></p></font>    <p style="margin-top: 0; margin-bottom: 0">    <font size="1" face="Courier New">UDT::bind(u, &amp;known_addr,    sizeof(known_addr));</font></p>    <p><font face="Courier New" size="1">UDT::connect(u, &amp;peer_addr, sizeof(peer_addr));</font></td>  </tr></table><p>However, UDT does not support SO_REUSEADDR option.When both the user are behind firewalls and they talk to a known server for thepeer address and port, a UDT socket can be set up first and connect to theserver. After it retrieves the information about the peer side, it should thendisconnect and start this rendezvous connection to the peer side.</p></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -