NetworkInterface.IsReceiveOnly Свойство
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Возвращает значение типа Boolean, указывающее, настроен ли сетевой интерфейс только на прием пакетов данных.
public:
virtual property bool IsReceiveOnly { bool get(); };
public:
abstract property bool IsReceiveOnly { bool get(); };
public virtual bool IsReceiveOnly { get; }
public abstract bool IsReceiveOnly { get; }
member this.IsReceiveOnly : bool
Public Overridable ReadOnly Property IsReceiveOnly As Boolean
Public MustOverride ReadOnly Property IsReceiveOnly As Boolean
Значение свойства
Значение true
, если интерфейс только принимает сетевой трафик; в противном случае — false
.
Исключения
Это свойство не поддерживается на компьютерах с операционными системами более ранних версий, чем Windows XP.
Примеры
В следующем примере кода отображается сводка по всем интерфейсам на локальном компьютере.
void DisplayTypeAndAddress()
{
IPGlobalProperties ^ computerProperties = IPGlobalProperties::GetIPGlobalProperties();
array<NetworkInterface^>^nics = NetworkInterface::GetAllNetworkInterfaces();
Console::WriteLine( "Interface information for {0}.{1} ", computerProperties->HostName, computerProperties->DomainName );
System::Collections::IEnumerator^ myEnum27 = nics->GetEnumerator();
while ( myEnum27->MoveNext() )
{
NetworkInterface ^ adapter = safe_cast<NetworkInterface ^>(myEnum27->Current);
IPInterfaceProperties ^ properties = adapter->GetIPProperties();
Console::WriteLine( adapter->Description );
Console::WriteLine( String::Empty->PadLeft( adapter->Description->Length, '=' ) );
Console::WriteLine( " Interface type .......................... : {0}",
adapter->NetworkInterfaceType );
Console::WriteLine( " Physical Address ........................ : {0}",
adapter->GetPhysicalAddress() );
Console::WriteLine( " Is receive only.......................... : {0}",
adapter->IsReceiveOnly );
Console::WriteLine( " Multicast................................ : {0}",
adapter->SupportsMulticast );
}
}
public static void DisplayTypeAndAddress()
{
IPGlobalProperties computerProperties = IPGlobalProperties.GetIPGlobalProperties();
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
Console.WriteLine("Interface information for {0}.{1} ",
computerProperties.HostName, computerProperties.DomainName);
foreach (NetworkInterface adapter in nics)
{
IPInterfaceProperties properties = adapter.GetIPProperties();
Console.WriteLine(adapter.Description);
Console.WriteLine(String.Empty.PadLeft(adapter.Description.Length,'='));
Console.WriteLine(" Interface type .......................... : {0}", adapter.NetworkInterfaceType);
Console.WriteLine(" Physical Address ........................ : {0}",
adapter.GetPhysicalAddress().ToString());
Console.WriteLine(" Is receive only.......................... : {0}", adapter.IsReceiveOnly);
Console.WriteLine(" Multicast................................ : {0}", adapter.SupportsMulticast);
Console.WriteLine();
}
}
Public Shared Sub DisplayTypeAndAddress()
Dim computerProperties As IPGlobalProperties = IPGlobalProperties.GetIPGlobalProperties()
Dim nics As NetworkInterface() = NetworkInterface.GetAllNetworkInterfaces()
Console.WriteLine("Interface information for {0}.{1} ", computerProperties.HostName, computerProperties.DomainName)
Dim adapter As NetworkInterface
For Each adapter In nics
Dim properties As IPInterfaceProperties = adapter.GetIPProperties()
Console.WriteLine(adapter.Description)
Console.WriteLine(String.Empty.PadLeft(adapter.Description.Length, "="c))
Console.WriteLine(" Interface type .......................... : {0}", adapter.NetworkInterfaceType)
Console.WriteLine(" Physical Address ........................ : {0}", adapter.GetPhysicalAddress().ToString())
Console.WriteLine(" Is receive only.......................... : {0}", adapter.IsReceiveOnly)
Console.WriteLine(" Multicast................................ : {0}", adapter.SupportsMulticast)
Next adapter
End Sub