NetworkInterface.IsReceiveOnly Property

 

Gets a Boolean value that indicates whether the network interface is set to only receive data packets.

Namespace:   System.Net.NetworkInformation
Assembly:  System (in System.dll)

public virtual bool IsReceiveOnly { get; }

Property Value

Type: System.Boolean

true if the interface only receives network traffic; otherwise, false.

Exception Condition
PlatformNotSupportedException

This property is not valid on computers running operating systems earlier than Windows XP.

The following code example displays a summary for all interfaces on the local computer.

 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();
      }
   }

.NET Framework
Available since 2.0
Return to top
Show: