2004-05-13 Dick Porter <dick@ximian.com>
authorDick Porter <dick@acm.org>
Thu, 13 May 2004 16:22:40 +0000 (16:22 -0000)
committerDick Porter <dick@acm.org>
Thu, 13 May 2004 16:22:40 +0000 (16:22 -0000)
* UdpClient.cs:
* TcpClient.cs: Public API fixes

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

mcs/class/System/System.Net.Sockets/ChangeLog
mcs/class/System/System.Net.Sockets/TcpClient.cs
mcs/class/System/System.Net.Sockets/UdpClient.cs

index fbea6a289b77391df2ea36a442326e5504a66a79..3c81b6f5d07ee4b9b3f2c440bc479374d51aaefe 100644 (file)
@@ -1,3 +1,8 @@
+2004-05-13  Dick Porter  <dick@ximian.com>
+
+       * UdpClient.cs: 
+       * TcpClient.cs: Public API fixes
+
 2004-05-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
 
        * Socket.cs: fixed Connect for non-blocking sockets. Closes bug #58169.
index e89c9bca75fc8727fe471a61d3443c867e1bba57..3a743f4920e7f74c254fb808a54bcb105f3eea87 100755 (executable)
@@ -53,6 +53,19 @@ namespace System.Net.Sockets
                        client.Bind(new IPEndPoint(IPAddress.Any, 0));
                }
        
+#if NET_1_1
+               public TcpClient (AddressFamily family)
+               {
+                       if (family != AddressFamily.InterNetwork &&
+                           family != AddressFamily.InterNetworkV6) {
+                               throw new ArgumentException ("Family must be InterNetwork or InterNetworkV6", "family");
+                       }
+                       
+                       Init (family);
+                       client.Bind (new IPEndPoint (IPAddress.Any, 0));
+               }
+#endif
+               
                /// <summary>
                /// Constructs a new TcpClient with a specified local endpoint.
                /// Use this if you want to have your connections originating
index 9722c06b3cadc3982047e2384da5364e8bd1ca75..41bd028a41334106434a85b15232a9f03ca211e5 100644 (file)
@@ -24,6 +24,7 @@ namespace System.Net.Sockets
                {\r
                }\r
 \r
+#if NET_1_1
                public UdpClient(AddressFamily family)\r
                {\r
                        if(family != AddressFamily.InterNetwork && family != AddressFamily.InterNetwork)\r
@@ -32,6 +33,7 @@ namespace System.Net.Sockets
                        this.family = family;\r
                        InitSocket (null);\r
                }\r
+#endif
 \r
                public UdpClient (int port)\r
                {\r
@@ -53,7 +55,27 @@ namespace System.Net.Sockets
 \r
                        InitSocket (localEP);\r
                }\r
-\r
+
+#if NET_1_1
+               public UdpClient (int port, AddressFamily family)
+               {
+                       if (family != AddressFamily.InterNetwork &&
+                           family != AddressFamily.InterNetworkV6) {
+                               throw new ArgumentException ("Family must be InterNetwork or InterNetworkV6", "family");
+                       }
+                       
+                       if (port < IPEndPoint.MinPort ||
+                           port > IPEndPoint.MaxPort) {
+                               throw new ArgumentOutOfRangeException ("port");
+                       }
+                       
+                       this.family = family;
+
+                       IPEndPoint localEP = new IPEndPoint (IPAddress.Any, port);
+                       InitSocket (localEP);
+               }
+#endif
+               
                public UdpClient (string hostname, int port)\r
                {\r
                        if (hostname == null)\r
@@ -150,7 +172,31 @@ namespace System.Net.Sockets
                                        new IPv6MulticastOption (multicastAddr));\r
 #endif\r
                }\r
-\r
+
+#if NET_1_1
+               public void DropMulticastGroup (IPAddress multicastAddr,
+                                               int ifindex)
+               {
+                       CheckDisposed ();
+
+                       /* LAMESPEC: exceptions haven't been specified
+                        * for this overload.
+                        */
+                       if (multicastAddr == null) {
+                               throw new ArgumentNullException ("multicastAddr");
+                       }
+
+                       /* Does this overload only apply to IPv6?
+                        * Only the IPv6MulticastOption has an
+                        * ifindex-using constructor.  The MS docs
+                        * don't say.
+                        */
+                       if (family == AddressFamily.InterNetworkV6) {
+                               socket.SetSocketOption (SocketOptionLevel.IPv6, SocketOptionName.DropMembership, new IPv6MulticastOption (multicastAddr, ifindex));
+                       }
+               }
+#endif
+               
                public void JoinMulticastGroup (IPAddress multicastAddr)\r
                {\r
                        CheckDisposed ();\r
@@ -164,7 +210,24 @@ namespace System.Net.Sockets
                                        new IPv6MulticastOption (multicastAddr));\r
 #endif\r
                }\r
-\r
+
+#if NET_1_1
+               public void JoinMulticastGroup (int ifindex,
+                                               IPAddress multicastAddr)
+               {
+                       CheckDisposed ();
+
+                       /* Does this overload only apply to IPv6?
+                        * Only the IPv6MulticastOption has an
+                        * ifindex-using constructor.  The MS docs
+                        * don't say.
+                        */
+                       if (family == AddressFamily.InterNetworkV6) {
+                               socket.SetSocketOption (SocketOptionLevel.IPv6, SocketOptionName.AddMembership, new IPv6MulticastOption (multicastAddr, ifindex));
+                       }
+               }
+#endif
+               
                public void JoinMulticastGroup (IPAddress multicastAddr, int timeToLive)\r
                {\r
                        CheckDisposed ();\r