?? t-firewall.htm
字號:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Introduction</title>
<link rel="stylesheet" href="udtdoc.css" type="text/css" />
</head>
<body>
<div class="ref_head"> UDT Tutorial</div>
<h3><font color="#000080">Firewall Traversing with UDT</font></h3>
<p>While UDT was originally written for extremely high speed data transfer, there are many other potential benefits from this reliable UDP-based library. One particular usage is to setup
reliable connections between machines behind firewalls, especially those NAT firewalls. To meet this requirement, UDT has added the rendezvous connection setup support.</p>
<p>Traditional BSD socket setup process requires explicit server side and client side. To punch NAT firewalls, a common method is to use the SO_REUSEADDR socket option to open two sockets
bound to the same port, one listens and the other connects. UDT provides the more convenient rendezvous connection setup, in which there is no server or client, and two users can connect to
each other directly.</p>
<p>With UDT, all sockets within one process can be bound to the same UDP port (but at most one listening socket on the same port is allowed). This is also helpful for system administrators to open a specific UDP port for all UDT traffic. </p>
<p>Example: Rendezvous connection setup. (Note that there is no need to set UDT_REUSEADDR here because it is true by default.) </p>
<div class="code">
UDTSOCKET u;<br>
...<br>
<br>
bool rendezvous = true;<br>
UDT::setsockopt(u, 0, UDT_RENDEZVOUS, &rendezvous, sizeof(bool));<br>
UDT::bind(u, &known_addr, sizeof(known_addr));<br>
UDT::connect(u, &peer_addr, sizeof(peer_addr));
</div>
<p>Finally, note that UDT does not automatically traverse any types of firewalls. It just provide a convinient API and applications may still need to finish more work, such as a name
server for NAT.</p>
<p> </p>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -