[System] More Socket methods from referencesource
authorMarek Safar <marek.safar@gmail.com>
Mon, 17 Oct 2016 13:04:01 +0000 (15:04 +0200)
committerMarek Safar <marek.safar@gmail.com>
Mon, 17 Oct 2016 13:04:39 +0000 (15:04 +0200)
mcs/class/System/System.Net.Sockets/Socket.cs
mcs/class/System/Test/System.Net.Sockets/TcpClientTest.cs
mcs/class/referencesource/System/net/System/Net/Sockets/Socket.cs

index 9857fc27ed0b86ef0d14695a00a541a21784f888..1feee9dedea869ebbffb84bd2bbe9fe1d946806f 100644 (file)
@@ -844,51 +844,6 @@ namespace System.Net.Sockets
                        Connect (Dns.GetHostAddresses (host), port);
                }
 
-               public void Connect (IPAddress[] addresses, int port)
-               {
-                       ThrowIfDisposedAndClosed ();
-
-                       if (addresses == null)
-                               throw new ArgumentNullException ("addresses");
-                       if (this.AddressFamily != AddressFamily.InterNetwork && this.AddressFamily != AddressFamily.InterNetworkV6)
-                               throw new NotSupportedException ("This method is only valid for addresses in the InterNetwork or InterNetworkV6 families");
-                       if (is_listening)
-                               throw new InvalidOperationException ();
-
-                       // FIXME: do non-blocking sockets Poll here?
-                       int error = 0;
-                       foreach (IPAddress address in addresses) {
-                               IPEndPoint iep = new IPEndPoint (address, port);
-                               
-                               iep = RemapIPEndPoint (iep);
-
-                               Connect_internal (m_Handle, iep.Serialize (), out error, is_blocking);
-                               if (error == 0) {
-                                       is_connected = true;
-                                       is_bound = true;
-                                       seed_endpoint = iep;
-                                       return;
-                               }
-                               if (error != (int)SocketError.InProgress && error != (int)SocketError.WouldBlock)
-                                       continue;
-
-                               if (!is_blocking) {
-                                       Poll (-1, SelectMode.SelectWrite);
-                                       error = (int)GetSocketOption (SocketOptionLevel.Socket, SocketOptionName.Error);
-                                       if (error == 0) {
-                                               is_connected = true;
-                                               is_bound = true;
-                                               seed_endpoint = iep;
-                                               return;
-                                       }
-                               }
-                       }
-
-                       if (error != 0)
-                               throw new SocketException (error);
-               }
-
-
                public void Connect (EndPoint remoteEP)
                {
                        ThrowIfDisposedAndClosed ();
index a9e849fc1e77d0e9e4aec3513ee0f37c1e345b4a..5db3aadbc877713b962285ddcde3e66e83293cde 100644 (file)
@@ -173,7 +173,7 @@ namespace MonoTests.System.Net.Sockets
                                client.Connect (ipAddresses, 1234);
                                Assert.Fail ("ConnectMultiAny #1");
                        } catch (SocketException ex) {
-                               Assert.AreEqual (10061, ex.ErrorCode, "ConnectMultiAny #2");
+                               Assert.AreEqual (10049, ex.ErrorCode, "ConnectMultiAny #2");
                        } catch {
                                Assert.Fail ("ConnectMultiAny #3");
                        }
index 26248db1547dde54dbe4420740baf3ef93cbee90..985b7d22fa0144f2263abfd345b7e55c3ceea691 100644 (file)
@@ -1106,6 +1106,7 @@ namespace System.Net.Sockets {
             Connect(addresses,port);
             if(s_LoggingEnabled)Logging.Exit(Logging.Sockets, this, "Connect", null);
         }
+#endif // !MONO
 
         public void Connect(IPAddress[] addresses, int port){
             if(s_LoggingEnabled)Logging.Enter(Logging.Sockets, this, "Connect", addresses);
@@ -1154,7 +1155,7 @@ namespace System.Net.Sockets {
             if(s_LoggingEnabled)Logging.Exit(Logging.Sockets, this, "Connect", null);
         }
 
-
+#if !MONO
         /// <devdoc>
         ///    <para>
         ///       Forces a socket connection to close.