Exemplo n.º 1
0
        internal SystemIPGlobalStatistics(AddressFamily family)
        {
            uint result = UnsafeNetInfoNativeMethods.GetIpStatisticsEx(out stats, family);

            if (result != IpHelperErrors.Success)
            {
                throw new NetworkInformationException((int)result);
            }
        }
        internal SystemIPGlobalStatistics(AddressFamily family)
        {
            uint ipStatistics;

            this.stats = new MibIpStats();
            if (!ComNetOS.IsPostWin2K)
            {
                if (family != AddressFamily.InterNetwork)
                {
                    throw new PlatformNotSupportedException(SR.GetString("WinXPRequired"));
                }
                ipStatistics = UnsafeNetInfoNativeMethods.GetIpStatistics(out this.stats);
            }
            else
            {
                ipStatistics = UnsafeNetInfoNativeMethods.GetIpStatisticsEx(out this.stats, family);
            }
            if (ipStatistics != 0)
            {
                throw new NetworkInformationException((int)ipStatistics);
            }
        }