IPGlobalStatistics.ForwardingEnabled 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
會獲得 Boolean 一個值,指定是否啟用網際網路協定(IP)封包轉發。
public:
abstract property bool ForwardingEnabled { bool get(); };
[System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract bool ForwardingEnabled { get; }
public abstract bool ForwardingEnabled { get; }
[<System.Runtime.Versioning.UnsupportedOSPlatform("android")>]
member this.ForwardingEnabled : bool
member this.ForwardingEnabled : bool
Public MustOverride ReadOnly Property ForwardingEnabled As Boolean
屬性值
一個 Boolean 指定是否啟用封包轉發的值。
- 屬性
範例
以下程式碼範例顯示此屬性的值。
public static void ShowIPStatistics()
{
IPGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties();
IPGlobalStatistics ipstat = properties.GetIPv4GlobalStatistics();
Console.WriteLine(" Forwarding enabled ...................... : {0}",
ipstat.ForwardingEnabled);
Console.WriteLine(" Interfaces .............................. : {0}",
ipstat.NumberOfInterfaces);
Console.WriteLine(" IP addresses ............................ : {0}",
ipstat.NumberOfIPAddresses);
Console.WriteLine(" Routes .................................. : {0}",
ipstat.NumberOfRoutes);
Console.WriteLine(" Default TTL ............................. : {0}",
ipstat.DefaultTtl);
}
Public Shared Sub ShowIPStatistics()
Dim properties As IPGlobalProperties = IPGlobalProperties.GetIPGlobalProperties()
Dim ipstat As IPGlobalStatistics = properties.GetIPv4GlobalStatistics()
Console.WriteLine(" Forwarding enabled ...................... : {0}", ipstat.ForwardingEnabled)
Console.WriteLine(" Interfaces .............................. : {0}", ipstat.NumberOfInterfaces)
Console.WriteLine(" IP addresses ............................ : {0}", ipstat.NumberOfIPAddresses)
Console.WriteLine(" Routes .................................. : {0}", ipstat.NumberOfRoutes)
Console.WriteLine(" Default TTL ............................. : {0}", ipstat.DefaultTtl)
End Sub
備註
此值決定電腦是否轉發指向另一台電腦的 IP 資料報。 通常,路由器會轉發封包,而主機電腦則不會。