SoFunction
Updated on 2025-03-07

C# code to get the IP address of the machine

private String GetIPAddress()
{
            String str;
            String Result = "";
            String hostName = ();
            IPAddress[] myIP = (hostName);
            foreach (IPAddress address in myIP)
            {
                str = ();
                for (int i = 0; i < ; i++)
                {
                    if (str[i] >= '0' && str[i] <= '9' || str[i] == '.') Result = str;
                }
            }
            return Result;
}