From 6c07557debc9b118356457768ba85c1518b6bbf5 Mon Sep 17 00:00:00 2001 From: rawer470 Date: Sat, 17 Aug 2024 19:02:02 +0300 Subject: [PATCH] FixGetIp --- .../GameManagers/NetworkManager/ServerNetworkManager.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/ServerNetworkManager.cs b/ZoFo/GameCore/GameManagers/NetworkManager/ServerNetworkManager.cs index 1d0ae62..9ea5de2 100644 --- a/ZoFo/GameCore/GameManagers/NetworkManager/ServerNetworkManager.cs +++ b/ZoFo/GameCore/GameManagers/NetworkManager/ServerNetworkManager.cs @@ -53,8 +53,9 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager /// public static IPAddress GetIp() { - string hostName = Dns.GetHostName(); // Retrive the Name of HOST - string myIP = Dns.GetHostByName(hostName).AddressList[1].ToString();// Get the IP + string hostName = Dns.GetHostName(); // Retrive the Name of HOST + var ipList = Dns.GetHostByName(hostName).AddressList; + string myIP = ipList[ipList.Count()-1].ToString();// Get the IP return IPAddress.Parse(myIP); }