summaryrefslogtreecommitdiff
path: root/mcs/class/System/Test/System.Net.Sockets/SocketTest.cs
diff options
context:
space:
mode:
Diffstat (limited to 'mcs/class/System/Test/System.Net.Sockets/SocketTest.cs')
-rwxr-xr-x[-rw-r--r--]mcs/class/System/Test/System.Net.Sockets/SocketTest.cs48
1 files changed, 48 insertions, 0 deletions
diff --git a/mcs/class/System/Test/System.Net.Sockets/SocketTest.cs b/mcs/class/System/Test/System.Net.Sockets/SocketTest.cs
index 6f0e4cf3ee..4bd26f9fae 100644..100755
--- a/mcs/class/System/Test/System.Net.Sockets/SocketTest.cs
+++ b/mcs/class/System/Test/System.Net.Sockets/SocketTest.cs
@@ -4144,6 +4144,54 @@ namespace MonoTests.System.Net.Sockets
}
[Test]
+ public void SetSocketOption_MulticastInterfaceIndex_Any ()
+ {
+ IPAddress ip = IPAddress.Parse ("239.255.255.250");
+ int index = 0;
+ using (Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp))
+ {
+ s.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastInterface, IPAddress.HostToNetworkOrder(index));
+ s.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(ip, index));
+ }
+ }
+
+ [Test]
+ public void SetSocketOption_MulticastInterfaceIndex_Loopback ()
+ {
+ IPAddress ip = IPAddress.Parse ("239.255.255.250");
+ int index = 1;
+ using (Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp))
+ {
+ s.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastInterface, IPAddress.HostToNetworkOrder(index));
+ s.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(ip, index));
+ }
+ }
+
+ [Test]
+ public void SetSocketOption_MulticastInterfaceIndex_Invalid ()
+ {
+ IPAddress ip = IPAddress.Parse ("239.255.255.250");
+ int index = 31415;
+ using (Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp))
+ {
+ try
+ {
+ s.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastInterface, IPAddress.HostToNetworkOrder(index));
+ Assert.Fail ("#1");
+ }
+ catch
+ {}
+ try
+ {
+ s.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(ip, index));
+ Assert.Fail ("#2");
+ }
+ catch
+ {}
+ }
+ }
+
+ [Test]
public void Shutdown_NoConnect ()
{
Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);