Desktop Functions:

   Smart Device Functions:

Show Recent Changes
Subscribe (RSS)
Misc. Pages
Helpful Tools
Suggested Reading
Website TODO List
Support Forum
Download Visual Studio Add-In

Terms of Use
Privacy Policy
MIB_IPNETROW (iphlpapi)

C# Signature:

    struct MIB_IPNETROW
        /// <summary>
        /// The index of the adapter.
        /// </summary>
        public int dwIndex;
        /// <summary>
        /// The length, in bytes, of the physical address.
        /// </summary>
        public int dwPhysAddrLen;
        /// <summary>
        /// The physical address.
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst=IPHelper.MAXLEN_PHYSADDR)]
        public byte[] bPhysAddr;
        /// <summary>
        /// The IPv4 address.
        /// </summary>
        public int dwAddr;
        /// <summary>
        /// The type of ARP entry. This type can be one of the following values.
        /// </summary>
        public IPNetRowType dwType;

User-Defined Types:

    public class IPHelper
        public const int NO_ERROR = 0;

        /// <summary>
        /// The buffer pointed to by the pIpNetTable parameter is not large enough.
        /// The required size is returned in the DWORD variable pointed to
        /// by the pdwSize parameter.
        /// </summary>
        public const int ERROR_INSUFFICIENT_BUFFER = 122;

        /// <summary>
        /// An invalid parameter was passed to the function. This error is returned
        /// if the pdwSize parameter is NULL, or GetIpNetTable is unable to write
        /// to the memory pointed to by the pdwSize parameter.
        /// </summary>
        public const int ERROR_INVALID_PARAMETER   = 87;

        /// <summary>
        /// The IPv4 transport is not configured on the local computer.
        /// </summary>
        public const int ERROR_NOT_SUPPORTED = 50;

        public const int MAXLEN_PHYSADDR = 8;

        /// <summary>
        /// The GetIpNetTable function retrieves the IP-to-physical address mapping table.
        /// </summary>
        /// <param name="pIpNetTable">A pointer to a buffer that receives the
        ///        IP-to-physical address mapping table as a MIB_IPNETTABLE structure.</param>
        /// <param name="pdwSize">On input, specifies the size of the buffer pointed to
        /// by the pIpNetTable parameter.
        /// <para>On output, if the buffer is not large enough to hold the returned mapping table,
        /// the function sets this parameter equal to the required buffer size</para></param>
        /// <param name="bOrder">A Boolean value that specifies whether the returned mapping
        /// table should be sorted in ascending order by IP address. If this parameter is TRUE,
        /// the table is sorted.</param>
        /// <returns>If the function succeeds, the return value is NO_ERROR.
        /// <para>If the function fails, the return value is one of the following error codes:
        /// </para>
        /// </returns>
        [DllImport("Iphlpapi.dll", EntryPoint="GetIpNetTable")]
        private static extern int GetIpNetTable(IntPtr pIpNetTable, ref int pdwSize, bool bOrder);

Alternative Managed API:

Do you know one? Please contribute it!



Tips & Tricks:

Please add some!

Sample Code:

Please add some!


Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

Access directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version