diff --git a/mcs/class/System/System.Net.NetworkInformation/IPGlobalProperties.cs b/mcs/class/System/System.Net.NetworkInformation/IPGlobalProperties.cs index b93b53ae0a28..7246735678d0 100644 --- a/mcs/class/System/System.Net.NetworkInformation/IPGlobalProperties.cs +++ b/mcs/class/System/System.Net.NetworkInformation/IPGlobalProperties.cs @@ -622,6 +622,9 @@ public override NetBiosNodeType NodeType { [DllImport ("iphlpapi.dll")] static extern int GetIpStatisticsEx (out Win32_MIB_IPSTATS pStats, int dwFamily); + [DllImport ("Ws2_32.dll")] + static extern ushort ntohs (ushort netshort); + // Win32 structures [StructLayout (LayoutKind.Explicit)] @@ -682,10 +685,10 @@ public TcpConnectionInformation TcpInfo { class Win32_MIB_UDPROW { public uint LocalAddr; - public int LocalPort; + public uint LocalPort; public IPEndPoint LocalEndPoint { - get { return new IPEndPoint (LocalAddr, LocalPort); } + get { return new IPEndPoint (LocalAddr, ntohs((ushort)LocalPort)); } } }