You can use the following method:
First, add a namespace:
Using system.net;
Get this machine IP as follows:
System.net.Ipaddress addr = new system.net.ipaddress (DNS.GethostName (DNS.GETHOSTNAME ()). AddressList [0] .address);