[DllImport("mpr.dll", CharSet = CharSet.Unicode)]
[return: MarshalAs(UnmanagedType.U4)]
static extern int MultinetGetConnectionPerformance(
NetResource lpNetResource,
ref NetConnectInfoStruct lpNetConnectInfoStruct);
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NetConnectInfoStruct {
public int cbStructure;
public WNCON dwFlags;
public int dwSpeed;
public int dwDelay;
public int dwOptDataSize;
}
[Flags]
public enum WNCON {
/// <summary>
/// In the absence of information about the actual connection,
/// the information returned applies to the performance of the
/// network card.
/// If this flag is not set, information is being returned for
/// the current connection with the resource, with any routing
/// degradation taken into consideration.
/// </summary>
FORNETCARD = 0x00000001,
/// <summary>
/// The connection is not being routed.
/// If this flag is not set, the connection may be going through
/// routers that limit performance. Consequently, if
/// WNCON_FORNETCARD is set, actual performance may be much less
/// than the information returned.
/// </summary>
NOTROUTED = 0x00000002,
/// <summary>
/// The connection is over a medium that is typically slow (for
/// example, over a modem using a normal quality phone line).
/// You should not set the WNCON_SLOWLINK bit if the dwSpeed
/// member is set to a nonzero value.
/// </summary>
SLOWLINK = 0x00000004,
/// <summary>
/// Some of the information returned is calculated dynamically,
/// so reissuing this request may return different (and more
/// current) information.
/// </summary>
DYNAMIC = 0x00000008,
}
const int WNCON_FORNETCARD = 0x00000001;
const int WNCON_NOTROUTED = 0x00000002;
const int WNCON_SLOWLINK = 0x00000004;
const int WNCON_DYNAMIC = 0x00000008;
Do you know one? Please contribute it!
Don't forget to initialize cbStructure member.
NetConnectInfoStruct ci = new NetConnectInfoStruct();
ci.cbStructure = Marshal.SizeOf(ci);
Please add some!
Please add some!