diff options
author | Dick Porter <dick@acm.org> | 2004-05-13 20:22:40 +0400 |
---|---|---|
committer | Dick Porter <dick@acm.org> | 2004-05-13 20:22:40 +0400 |
commit | 0937ade06aeb736fef8b6fb9eeb1b6d92e599d12 (patch) | |
tree | 6506b1bdeebbcd6c8caaadf4d7ddd7d215efa83d /mcs/class/System/System.Net.Sockets | |
parent | c75ec101a34d0e5d064973c42d70fb57ab88a396 (diff) |
2004-05-13 Dick Porter <dick@ximian.com>
* UdpClient.cs:
* TcpClient.cs: Public API fixes
svn path=/trunk/mcs/; revision=27286
Diffstat (limited to 'mcs/class/System/System.Net.Sockets')
-rw-r--r-- | mcs/class/System/System.Net.Sockets/ChangeLog | 5 | ||||
-rwxr-xr-x | mcs/class/System/System.Net.Sockets/TcpClient.cs | 13 | ||||
-rw-r--r-- | mcs/class/System/System.Net.Sockets/UdpClient.cs | 69 |
3 files changed, 84 insertions, 3 deletions
diff --git a/mcs/class/System/System.Net.Sockets/ChangeLog b/mcs/class/System/System.Net.Sockets/ChangeLog index fbea6a289b7..3c81b6f5d07 100644 --- a/mcs/class/System/System.Net.Sockets/ChangeLog +++ b/mcs/class/System/System.Net.Sockets/ChangeLog @@ -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. diff --git a/mcs/class/System/System.Net.Sockets/TcpClient.cs b/mcs/class/System/System.Net.Sockets/TcpClient.cs index e89c9bca75f..3a743f4920e 100755 --- a/mcs/class/System/System.Net.Sockets/TcpClient.cs +++ b/mcs/class/System/System.Net.Sockets/TcpClient.cs @@ -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 diff --git a/mcs/class/System/System.Net.Sockets/UdpClient.cs b/mcs/class/System/System.Net.Sockets/UdpClient.cs index 9722c06b3ca..41bd028a413 100644 --- a/mcs/class/System/System.Net.Sockets/UdpClient.cs +++ b/mcs/class/System/System.Net.Sockets/UdpClient.cs @@ -24,6 +24,7 @@ namespace System.Net.Sockets {
}
+#if NET_1_1 public UdpClient(AddressFamily family)
{
if(family != AddressFamily.InterNetwork && family != AddressFamily.InterNetwork)
@@ -32,6 +33,7 @@ namespace System.Net.Sockets this.family = family;
InitSocket (null);
}
+#endif public UdpClient (int port)
{
@@ -53,7 +55,27 @@ namespace System.Net.Sockets InitSocket (localEP);
}
-
+ +#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)
{
if (hostname == null)
@@ -150,7 +172,31 @@ namespace System.Net.Sockets new IPv6MulticastOption (multicastAddr));
#endif
}
-
+ +#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)
{
CheckDisposed ();
@@ -164,7 +210,24 @@ namespace System.Net.Sockets new IPv6MulticastOption (multicastAddr));
#endif
}
-
+ +#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)
{
CheckDisposed ();
|