예제 #1
0
            internal static InternalIPAddressCollection MarshalIpAddressCollection(IntPtr ptr)
            {
                InternalIPAddressCollection addressList = new InternalIPAddressCollection();

                while (ptr != IntPtr.Zero)
                {
                    IpAdapterAddress addressStructure = Marshal.PtrToStructure <IpAdapterAddress>(ptr);
                    IPAddress        address          = addressStructure.address.MarshalIPAddress();
                    addressList.InternalAdd(address);

                    ptr = addressStructure.next;
                }

                return(addressList);
            }
예제 #2
0
            internal static IPAddressInformationCollection MarshalIpAddressInformationCollection(IntPtr ptr)
            {
                IPAddressInformationCollection addressList = new IPAddressInformationCollection();

                while (ptr != IntPtr.Zero)
                {
                    IpAdapterAddress addressStructure = Marshal.PtrToStructure <IpAdapterAddress>(ptr);
                    IPAddress        address          = addressStructure.address.MarshalIPAddress();
                    addressList.InternalAdd(new SystemIPAddressInformation(address, addressStructure.flags));

                    ptr = addressStructure.next;
                }

                return(addressList);
            }