6to4 android,TcpListener.AllowNatTraversal(Boolean) Method (System.Net.Sockets) | Microsoft Docs

允许或禁止TCP监听器实例上的网络地址转换(NAT)穿越。当allowed参数为false时,设置IP保护级别为EdgeRestricted,禁用NAT穿越;为true时,设置为Unrestricted,可能允许NAT穿越,具体取决于系统的防火墙规则。必须在启动监听之前调用此方法,否则会抛出异常。
摘要由CSDN通过智能技术生成

Enables or disables Network Address Translation (NAT) traversal on a TcpListener instance.

public:

void AllowNatTraversal(bool allowed);

[System.Runtime.Versioning.SupportedOSPlatform("windows")]

public void AllowNatTraversal (bool allowed);

public void AllowNatTraversal (bool allowed);

[]

member this.AllowNatTraversal : bool -> unit

member this.AllowNatTraversal : bool -> unit

Public Sub AllowNatTraversal (allowed As Boolean)

Parameters

allowed

A Boolean value that specifies whether to enable or disable NAT traversal.

Exceptions

Remarks

The AllowNatTraversal method is used to enable or disable NAT traversal for a TcpListener instance. NAT traversal may be provided using Teredo, 6to4, or an ISATAP tunnel.

When the allowed parameter is false, the IPProtectionLevel option on the associated socket is set to EdgeRestricted. This explicitly disables NAT traversal for a TcpListener instance.

When the allowed parameter is true, the IPProtectionLevel option on the associated socket is set to Unrestricted. This may allow NAT traversal for a TcpListener depending on firewall rules in place on the system.

The AllowNatTraversal method must be invoked prior to calling the Start method to begin listening for incoming connection requests (before the socket is bound). If AllowNatTraversal method is called after the Start method, then an InvalidOperationException will be thrown.

A Teredo address is an IPv6 address with the prefix of 2001::/32. Teredo addresses can be returned through normal DNS name resolution or enumerated as an IPv6 address assigned to a local interface.

Applies to

See also

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值