public static MulticastIPAddressInformationImplCollection LinuxFromList(List <IPAddress> addresses)
        {
            MulticastIPAddressInformationImplCollection multicastIPAddressInformationImplCollection = new MulticastIPAddressInformationImplCollection(isReadOnly: false);

            foreach (IPAddress address in addresses)
            {
                multicastIPAddressInformationImplCollection.Add(new MulticastIPAddressInformationImpl(address, isDnsEligible: true, isTransient: false));
            }
            multicastIPAddressInformationImplCollection.is_readonly = true;
            return(multicastIPAddressInformationImplCollection);
        }
        public static MulticastIPAddressInformationImplCollection LinuxFromList(List <IPAddress> addresses)
        {
            MulticastIPAddressInformationImplCollection multicastIPAddressInformationImplCollection = new MulticastIPAddressInformationImplCollection(false);

            foreach (IPAddress address in addresses)
            {
                multicastIPAddressInformationImplCollection.Add(new MulticastIPAddressInformationImpl(address, true, false));
            }
            multicastIPAddressInformationImplCollection.is_readonly = true;
            return(multicastIPAddressInformationImplCollection);
        }
        public static MulticastIPAddressInformationCollection Win32FromMulticast(IntPtr ptr)
        {
            MulticastIPAddressInformationImplCollection multicastIPAddressInformationImplCollection = new MulticastIPAddressInformationImplCollection(isReadOnly: false);
            IntPtr intPtr = ptr;

            while (intPtr != IntPtr.Zero)
            {
                Win32_IP_ADAPTER_MULTICAST_ADDRESS win32_IP_ADAPTER_MULTICAST_ADDRESS = (Win32_IP_ADAPTER_MULTICAST_ADDRESS)Marshal.PtrToStructure(intPtr, typeof(Win32_IP_ADAPTER_MULTICAST_ADDRESS));
                multicastIPAddressInformationImplCollection.Add(new MulticastIPAddressInformationImpl(win32_IP_ADAPTER_MULTICAST_ADDRESS.Address.GetIPAddress(), win32_IP_ADAPTER_MULTICAST_ADDRESS.LengthFlags.IsDnsEligible, win32_IP_ADAPTER_MULTICAST_ADDRESS.LengthFlags.IsTransient));
                intPtr = win32_IP_ADAPTER_MULTICAST_ADDRESS.Next;
            }
            multicastIPAddressInformationImplCollection.is_readonly = true;
            return(multicastIPAddressInformationImplCollection);
        }
Пример #4
0
        public static MulticastIPAddressInformationCollection Win32FromMulticast(IntPtr ptr)
        {
            MulticastIPAddressInformationImplCollection c = new MulticastIPAddressInformationImplCollection(false);
            Win32_IP_ADAPTER_MULTICAST_ADDRESS          a;

            for (IntPtr p = ptr; p != IntPtr.Zero; p = a.Next)
            {
                a = (Win32_IP_ADAPTER_MULTICAST_ADDRESS)Marshal.PtrToStructure(p, typeof(Win32_IP_ADAPTER_MULTICAST_ADDRESS));
                c.Add(new MulticastIPAddressInformationImpl(
                          a.Address.GetIPAddress(),
                          a.LengthFlags.IsDnsEligible,
                          a.LengthFlags.IsTransient));
            }
            c.is_readonly = true;
            return(c);
        }