Example #1
0
        /// <summary>
        /// Gets the IPv4 statistics.
        /// </summary>
        /// <returns>An OpenNETCF.Net.NetworkInformation.IPv4InterfaceStatistics object.</returns>
        public IPv4InterfaceStatistics GetIPv4Statistics()
        {
            m_mibifRow = NetworkInterface.GetMibIfRow(Index);

            IPv4InterfaceStatistics stats = new IPv4InterfaceStatistics(m_mibifRow);

            return(stats);
        }
Example #2
0
        /// <summary>
        /// Returns an object that describes the configuration of this network interface.
        /// </summary>
        /// <returns>
        /// An System.Net.NetworkInformation.IPInterfaceProperties object that describes
        /// this network interface.
        /// </returns>
        /// <remarks>Note that the information in the object returned by this method reflects the interfaces as of the time the array is created. This information is not updated dynamically.</remarks>
        public IPInterfaceProperties GetIPProperties()
        {
            m_adapterInfo = GetAdapterInfo(Index);
            m_mibifRow    = NetworkInterface.GetMibIfRow(Index);

            IPInterfaceProperties props = new IPInterfaceProperties(m_adapterInfo, m_mibifRow);

            return(props);
        }
Example #3
0
        internal IPv4InterfaceStatistics(MibIfRow mibifRow)
        {
            m_mibifRow = mibifRow;

            m_data = new byte[Size];
            if (NativeMethods.GetIfEntry(m_mibifRow) != NativeMethods.NO_ERROR)
            {
                int error = System.Runtime.InteropServices.Marshal.GetLastWin32Error();
                throw new NetworkInformationException(error);
            }
        }
		internal SystemIPInterfaceStatistics(ulong index)
		{
        	mif = new MibIfRow();

			mif.Index = (uint)index;

			int s = MibIfRow.GetSize();
			int code = GetIfEntry(mif.getBytes(), ref s);
			if (code != 0) 
				throw new NetworkInformationException(code);
		}
Example #5
0
        internal SystemIPInterfaceStatistics(ulong index)
        {
            mif = new MibIfRow();

            mif.Index = (uint)index;

            int s    = MibIfRow.GetSize();
            int code = GetIfEntry(mif.getBytes(), ref s);

            if (code != 0)
            {
                throw new NetworkInformationException(code);
            }
        }
        internal static MibIfRow GetMibIfRow(int adapterIndex)
        {
            MibIfRow row = new MibIfRow();

            row.Index = adapterIndex;
            int errorCode = NativeMethods.GetIfEntry(row);

            if (errorCode != NativeMethods.NO_ERROR)
            {
                throw new NetworkInformationException(errorCode);
            }

            return(row);
        }
Example #7
0
 /// <summary>
 /// Refreshes all statistics for the current NetworkInterface
 /// </summary>
 public void Refresh()
 {
     // just set the members to null so the next query will call the API again
     m_adapterInfo = null;
     m_mibifRow    = null;
 }
Example #8
0
 internal IPInterfaceProperties(IP_ADAPTER_INFO info, MibIfRow mibifRow)
 {
     m_info = info;
     m_mtu  = mibifRow.MTU;
 }