Browse Source

* IPEndPoint.cs: fixed bug #24666 in Serialize and Create methods,
byte ordering of address was backwards.

svn path=/trunk/mcs/; revision=4753

Lawrence Pit 23 years ago
parent
commit
b4060bcb7b
2 changed files with 15 additions and 10 deletions
  1. 5 0
      mcs/class/System/System.Net/ChangeLog
  2. 10 10
      mcs/class/System/System.Net/IPEndPoint.cs

+ 5 - 0
mcs/class/System/System.Net/ChangeLog

@@ -1,3 +1,8 @@
+2002-05-19  Lawrence Pit <[email protected]>
+
+	* IPEndPoint.cs: fixed bug #24666 in Serialize and Create methods, 
+	byte ordering of address was backwards.
+
 2002-05-13  Lawrence Pit <[email protected]>
 
 	* Dns.cs: Reimplemented (simplified and fixed) asynchronous methods by

+ 10 - 10
mcs/class/System/System.Net/IPEndPoint.cs

@@ -80,10 +80,10 @@ namespace System.Net {
 			}
 			
 			int port=(((int)sockaddr[2])<<8) + (int)sockaddr[3];
-			long address=(((long)sockaddr[4])<<24) +
-				(((long)sockaddr[5])<<16) +
-				(((long)sockaddr[6])<<8) +
-				(long)sockaddr[7];
+			long address=(((long)sockaddr[7])<<24) +
+				(((long)sockaddr[6])<<16) +
+				(((long)sockaddr[5])<<8) +
+				(long)sockaddr[4];
 
 			IPEndPoint ipe = new IPEndPoint(address, port);
 			
@@ -98,13 +98,13 @@ namespace System.Net {
 
 			// bytes 2 and 3 store the port, the rest
 			// stores the address
-			sockaddr[2]=(byte)((port>>8) & 0xff);
-			sockaddr[3]=(byte)(port & 0xff);
+			sockaddr [2] = (byte) ((port>>8) & 0xff);
+			sockaddr [3] = (byte) (port & 0xff);
 
-			sockaddr[4]=(byte)((address.Address >> 24) & 0xff);
-			sockaddr[5]=(byte)((address.Address >> 16) & 0xff);
-			sockaddr[6]=(byte)((address.Address >> 8) & 0xff);
-			sockaddr[7]=(byte)(address.Address & 0xff);
+			sockaddr [4] = (byte) (address.Address & 0xff);
+			sockaddr [5] = (byte) ((address.Address >> 8) & 0xff);
+			sockaddr [6] = (byte) ((address.Address >> 16) & 0xff);
+			sockaddr [7] = (byte) ((address.Address >> 24) & 0xff);
 			
 			return(sockaddr);
 		}