Fixed IPv6 problem.
authorPhilipp Knaack <philipp.knaack@identos.com>
Mon, 17 Dec 2018 13:00:48 +0000 (14:00 +0100)
committerPhilipp Knaack <philipp.knaack@identos.com>
Mon, 17 Dec 2018 13:00:48 +0000 (14:00 +0100)
src/communication/ConnectionTest/ConnectionTest/ConnectionTest/MainPage.xaml.cs

index 2cdf227..9d886e0 100644 (file)
@@ -32,9 +32,16 @@ namespace Bomberman
             con = new TcpJsonConnection(ServerPkgReceived);
 
             //con.Connect(IPAddress.Parse("10.29.17.60"));
-            con.Connect(Dns.GetHostEntry(Dns.GetHostName()).AddressList[1]);    //localhost
-
-
+            foreach (var addr in Dns.GetHostEntry(Dns.GetHostName()).AddressList)
+            {\r
+                if (addr.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)\r
+                {\r
+                    con.Connect(addr);    //localhost\r
+                    break;\r
+                }\r
+            }
+\r
+\r
             Entry ent = new Entry();
             ButtonLayout.Children.Add(ent);
             ent.TextChanged += Ent_TextChanged;