Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenric Müller <hemuller@microsoft.com>2017-01-17 18:14:26 +0300
committerHenric Müller <hemuller@microsoft.com>2017-01-25 18:34:09 +0300
commit65b7f542d622dc59ce43d9fd84dc88b8dcc7f296 (patch)
treeb8458fbe64c7d4983439c355041f7486ebf5b70c /mcs/class/System/Test
parentfd830218048a4074b6e0e2e731fdb94342fb410b (diff)
Fixing tests that asume IPV4 when first adapter is IPV6
Diffstat (limited to 'mcs/class/System/Test')
-rw-r--r--mcs/class/System/Test/System.Net.Sockets/UdpClientTest.cs10
-rw-r--r--mcs/class/System/Test/System.Net/HttpListener2Test.cs10
2 files changed, 16 insertions, 4 deletions
diff --git a/mcs/class/System/Test/System.Net.Sockets/UdpClientTest.cs b/mcs/class/System/Test/System.Net.Sockets/UdpClientTest.cs
index 33dc4464c86..29ab8ef2ca6 100644
--- a/mcs/class/System/Test/System.Net.Sockets/UdpClientTest.cs
+++ b/mcs/class/System/Test/System.Net.Sockets/UdpClientTest.cs
@@ -991,8 +991,14 @@ namespace MonoTests.System.Net.Sockets {
"BeginSend #4");
}
- IPEndPoint ep = new IPEndPoint (Dns.GetHostEntry (string.Empty).AddressList[0], 1236);
-
+ IPAddress[] addresses = Dns.GetHostEntry (string.Empty).AddressList;
+ IPEndPoint ep = null;
+ foreach (IPAddress a in addresses) {
+ if (a.AddressFamily == AddressFamily.InterNetwork) {
+ ep = new IPEndPoint (a, 1236);
+ break;
+ }
+ }
BSCalledBack.Reset ();
client.BeginSend (bytes, bytes.Length, ep,
diff --git a/mcs/class/System/Test/System.Net/HttpListener2Test.cs b/mcs/class/System/Test/System.Net/HttpListener2Test.cs
index 51e2990c0d1..abf4bf12bb6 100644
--- a/mcs/class/System/Test/System.Net/HttpListener2Test.cs
+++ b/mcs/class/System/Test/System.Net/HttpListener2Test.cs
@@ -874,8 +874,14 @@ namespace MonoTests.System.Net {
int port = NetworkHelpers.FindFreePort ();;
var h = new HttpListener ();
- h.Prefixes.Add ("http://" + machineAddress [0] + ":" + port + "/");
- h.Start ();
+ // Listen on the first IPV4 interface
+ foreach (IPAddress a in machineAddress) {
+ if (a.AddressFamily == AddressFamily.InterNetwork) {
+ h.Prefixes.Add ("http://" + a + ":" + port + "/");
+ h.Start ();
+ break;
+ }
+ }
try {
var c = new TcpClient ("localhost", port);