📄 classpstunclient.html
字号:
</tr></table><a name="a9" doxytag="PSTUNClient::CreateSocket"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> BOOL PSTUNClient::CreateSocket </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="classPUDPSocket.html">PUDPSocket</a> *& </td> <td class="mdname1" valign="top" nowrap> <em>socket</em> </td> <td class="md" valign="top">) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Create a single socket. The STUN protocol is used to create a socket for which the external IP address and port numbers are known. A <a class="el" href="classPUDPSocket.html">PUDPSocket</a> descendant is returned which will, in response to GetLocalAddress() return the externally visible IP and port rather than the local machines IP and socket.<p>The will create a new socket pointer. It is up to the caller to make sure the socket is deleted to avoid memory leaks.<p>The socket pointer is set to NULL if the function fails and returns FALSE. </td> </tr></table><a name="a10" doxytag="PSTUNClient::CreateSocketPair"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> BOOL PSTUNClient::CreateSocketPair </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="classPUDPSocket.html">PUDPSocket</a> *& </td> <td class="mdname" nowrap> <em>socket1</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap><a class="el" href="classPUDPSocket.html">PUDPSocket</a> *& </td> <td class="mdname" nowrap> <em>socket2</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Create a socket pair. The STUN protocol is used to create a pair of sockets with adjacent port numbers for which the external IP address and port numbers are known. <a class="el" href="classPUDPSocket.html">PUDPSocket</a> descendants are returned which will, in response to GetLocalAddress() return the externally visible IP and port rather than the local machines IP and socket.<p>The will create new socket pointers. It is up to the caller to make sure the sockets are deleted to avoid memory leaks.<p>The socket pointers are set to NULL if the function fails and returns FALSE. </td> </tr></table><a name="a8" doxytag="PSTUNClient::GetExternalAddress"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> BOOL PSTUNClient::GetExternalAddress </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="classPIPSocket_1_1Address.html">PIPSocket::Address</a> & </td> <td class="mdname" nowrap> <em>externalAddress</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>const <a class="el" href="classPTimeInterval.html">PTimeInterval</a> & </td> <td class="mdname" nowrap> <em>maxAge</em> = 1000</td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Determine the external router address. This will send UDP packets out using the STUN protocol to determine the intervening routers external IP address.<p>A cached address is returned provided it is no older than the time specified. </td> </tr></table><a name="a6" doxytag="PSTUNClient::GetNatType"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> <a class="el" href="classPSTUNClient.html#s12">NatTypes</a> PSTUNClient::GetNatType </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">BOOL </td> <td class="mdname1" valign="top" nowrap> <em>force</em> = FALSE </td> <td class="md" valign="top">) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Determine via the STUN protocol the NAT type for the router. This will cache the last determine NAT type. Use the force variable to guarantee an up to date value. <dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>force</em> </td><td>Force a new check </td></tr></table></dl> </td> </tr></table><a name="a7" doxytag="PSTUNClient::GetNatTypeName"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> <a class="el" href="classPString.html">PString</a> PSTUNClient::GetNatTypeName </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">BOOL </td> <td class="mdname1" valign="top" nowrap> <em>force</em> = FALSE </td> <td class="md" valign="top">) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Determine via the STUN protocol the NAT type for the router. As for <a class="el" href="classPSTUNClient.html#a6">GetNatType()</a> but returns an English string for the type. <dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>force</em> </td><td>Force a new check </td></tr></table></dl> </td> </tr></table><a name="a2" doxytag="PSTUNClient::GetServer"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> <a class="el" href="classPString.html">PString</a> PSTUNClient::GetServer </td> <td class="md" valign="top">( </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top">) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Get the current STUN server address and port being used. </td> </tr></table><a name="b1" doxytag="PSTUNClient::OpenSocket"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> bool PSTUNClient::OpenSocket </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="classPUDPSocket.html">PUDPSocket</a> & </td> <td class="mdname" nowrap> <em>socket</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap><a class="el" href="structPSTUNClient_1_1PortInfo.html">PortInfo</a> & </td> <td class="mdname" nowrap> <em>portInfo</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"> const<code> [protected]</code></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p> </td> </tr></table><a name="a5" doxytag="PSTUNClient::SetPortRanges"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> void PSTUNClient::SetPortRanges </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">WORD </td> <td class="mdname" nowrap> <em>portBase</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>WORD </td> <td class="mdname" nowrap> <em>portMax</em> = 0, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>WORD </td> <td class="mdname" nowrap> <em>portPairBase</em> = 0, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>WORD </td> <td class="mdname" nowrap> <em>portPairMax</em> = 0</td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -