Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Thibodeau <alexthibodeau@unity3d.com>2019-08-07 15:30:07 +0300
committerAlexander Köplinger <alex.koeplinger@outlook.com>2019-08-07 15:30:07 +0300
commit24bbb94b6b78d99dfbdc50859b39654779b32ef4 (patch)
tree81ffe89f46547c2d51c979d4f6bd38122e59cf75 /mcs/class/System
parentba1c949a24594c65d9fca77fb13c3af09c54c16b (diff)
Swap bytes for tcp port number because windows API gives us port in network order. (#16030)
Addresses the FIXME in Win32IPGlobalProperties.cs :: FillTcpTable Fixed Unity issue: issuetracker.unity3d.com/issues/ipglobalproperties-dot-getactivetcpconnections-return-different-port-numbers-when-compared-to-cli-netstat-a-output
Diffstat (limited to 'mcs/class/System')
-rw-r--r--mcs/class/System/System.Net.NetworkInformation/Win32IPGlobalProperties.cs22
1 files changed, 10 insertions, 12 deletions
diff --git a/mcs/class/System/System.Net.NetworkInformation/Win32IPGlobalProperties.cs b/mcs/class/System/System.Net.NetworkInformation/Win32IPGlobalProperties.cs
index 49d9a2617db..22f9c0e7ed7 100644
--- a/mcs/class/System/System.Net.NetworkInformation/Win32IPGlobalProperties.cs
+++ b/mcs/class/System/System.Net.NetworkInformation/Win32IPGlobalProperties.cs
@@ -38,8 +38,6 @@ namespace System.Net.NetworkInformation {
public const int AF_INET = 2;
public const int AF_INET6 = 23;
- // FIXME: it might be getting wrong table. I'm getting
- // different results from .NET 2.0.
unsafe void FillTcpTable (out List<Win32_MIB_TCPROW> tab4, out List<Win32_MIB_TCP6ROW> tab6)
{
tab4 = new List<Win32_MIB_TCPROW> ();
@@ -305,16 +303,16 @@ namespace System.Net.NetworkInformation {
{
public TcpState State;
public uint LocalAddr;
- public int LocalPort;
+ public uint LocalPort;
public uint RemoteAddr;
- public int RemotePort;
+ public uint RemotePort;
public IPEndPoint LocalEndPoint {
- get { return new IPEndPoint (LocalAddr, LocalPort); }
+ get { return new IPEndPoint (LocalAddr, ntohs((ushort)LocalPort)); }
}
public IPEndPoint RemoteEndPoint {
- get { return new IPEndPoint (RemoteAddr, RemotePort); }
+ get { return new IPEndPoint (RemoteAddr, ntohs((ushort)RemotePort)); }
}
public TcpConnectionInformation TcpInfo {
@@ -328,17 +326,17 @@ namespace System.Net.NetworkInformation {
public TcpState State;
public Win32_IN6_ADDR LocalAddr;
public uint LocalScopeId;
- public int LocalPort;
+ public uint LocalPort;
public Win32_IN6_ADDR RemoteAddr;
public uint RemoteScopeId;
- public int RemotePort;
+ public uint RemotePort;
public IPEndPoint LocalEndPoint {
- get { return new IPEndPoint (new IPAddress (LocalAddr.Bytes, LocalScopeId), LocalPort); }
+ get { return new IPEndPoint (new IPAddress (LocalAddr.Bytes, LocalScopeId), ntohs((ushort)LocalPort)); }
}
public IPEndPoint RemoteEndPoint {
- get { return new IPEndPoint (new IPAddress (RemoteAddr.Bytes, RemoteScopeId), RemotePort); }
+ get { return new IPEndPoint (new IPAddress (RemoteAddr.Bytes, RemoteScopeId), ntohs((ushort)RemotePort)); }
}
public TcpConnectionInformation TcpInfo {
@@ -362,10 +360,10 @@ namespace System.Net.NetworkInformation {
{
public Win32_IN6_ADDR LocalAddr;
public uint LocalScopeId;
- public int LocalPort;
+ public uint LocalPort;
public IPEndPoint LocalEndPoint {
- get { return new IPEndPoint (new IPAddress (LocalAddr.Bytes, LocalScopeId), LocalPort); }
+ get { return new IPEndPoint (new IPAddress (LocalAddr.Bytes, LocalScopeId), ntohs((ushort)LocalPort)); }
}
}
}