Forráskód Böngészése

2008-02-01 Dick Porter <[email protected]>

	* TcpClient.cs: If the Connect fails (when given an array of
	addresses) leave the socket object in a usable state.  Fixes bug
	355473.



svn path=/trunk/mcs/; revision=94523
Dick Porter 18 éve
szülő
commit
4fcd84462b

+ 6 - 0
mcs/class/System/System.Net.Sockets/ChangeLog

@@ -1,3 +1,9 @@
+2008-02-01  Dick Porter  <[email protected]>
+
+	* TcpClient.cs: If the Connect fails (when given an array of
+	addresses) leave the socket object in a usable state.  Fixes bug
+	355473.
+
 2007-11-13  Atsushi Enomoto  <[email protected]>
 
 	* NetworkStream.cs : in 2.0 Close() is not needed and does not exist.

+ 5 - 4
mcs/class/System/System.Net.Sockets/TcpClient.cs

@@ -358,10 +358,11 @@ namespace System.Net.Sockets
 					
 					break;
 				} catch (Exception e) {
-					if (client != null) {
-						client.Close ();
-						client = null;
-					}
+					/* Reinitialise the socket so
+					 * other properties still work
+					 * (see no-arg constructor)
+					 */
+					Init (AddressFamily.InterNetwork);
 
 					/* This is the last known
 					 * address, so re-throw the