public static string ReturnCurrentIPv4() { string ipv4Address = string.Empty; foreach (WlanClient.WlanInterface wlanInterface in Networking.client.Interfaces) { foreach (var ipAddr in wlanInterface.NetworkInterface.GetIPProperties().UnicastAddresses) { if (ipAddr.Address.AddressFamily == AddressFamily.InterNetwork && Networking.IsConnected() == true) { ipv4Address = ipAddr.Address.ToString(); } else { ipv4Address = SocketError.NotConnected.ToString(); } } } return(ipv4Address); }
public static string ReturnCurrentGateway() { string gateway = string.Empty; foreach (WlanClient.WlanInterface wlanInterface in Networking.client.Interfaces) { foreach (var ipAddr in wlanInterface.NetworkInterface.GetIPProperties().GatewayAddresses) { if (ipAddr.Address.AddressFamily == AddressFamily.InterNetwork && Networking.IsConnected() == true) { gateway = ipAddr.Address.ToString(); } else { gateway = SocketError.NotConnected.ToString(); } } } return(gateway); }