How To Get Local IP In C#

this is a simple code to get the local ip on c# first add imports; namespace and add this sub

//Author : Mohamed Shimran
//Blog :

   public string GetIp()
            System.Net.IPAddress[] IP = System.Net.Dns.GetHostAddresses(System.Net.Dns.GetHostName());
            for (int n = 0; n < IP.Length; n++)
                return IP[n].ToString();

now you can add this code to a click event or any other events to get the ip address



Post a Comment

Note: Only a member of this blog may post a comment.