Skip to content

Commit 5c9428b

Browse files
committed
Swap bytes for port number (case 1006506)
1 parent 3bb0be9 commit 5c9428b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

mcs/class/System/System.Net.NetworkInformation/IPGlobalProperties.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,9 @@ public override NetBiosNodeType NodeType {
622622
[DllImport ("iphlpapi.dll")]
623623
static extern int GetIpStatisticsEx (out Win32_MIB_IPSTATS pStats, int dwFamily);
624624

625+
[DllImport ("Ws2_32.dll")]
626+
static extern ushort ntohs (ushort netshort);
627+
625628
// Win32 structures
626629

627630
[StructLayout (LayoutKind.Explicit)]
@@ -682,10 +685,10 @@ public TcpConnectionInformation TcpInfo {
682685
class Win32_MIB_UDPROW
683686
{
684687
public uint LocalAddr;
685-
public int LocalPort;
688+
public uint LocalPort;
686689

687690
public IPEndPoint LocalEndPoint {
688-
get { return new IPEndPoint (LocalAddr, LocalPort); }
691+
get { return new IPEndPoint (LocalAddr, ntohs((ushort)LocalPort)); }
689692
}
690693
}
691694

0 commit comments

Comments
 (0)