I wanna know IP address of connection. Not Local IP.
Local IP: 192.168.#.# WAN IP: #.#.#.#
You see your WAN IP at http://whatismyip.org
I tried this soution but that gives Local IP.
using System;
using System.Linq;
using System.Net;
using System.Net.Sockets;
namespace FasterComputer
{
class Program
{
static void Main(string[] args)
{
string ip = Ipfind();
Console.WriteLine(ip);
Console.ReadLine();
}
static string Ipfind()
{
if (!System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
{
return "Disconnected";
}
IPHostEntry host = Dns.GetHostEntry(Dns.GetHostName());
return Convert.ToString(host
.AddressList
.FirstOrDefault(ip => ip.AddressFamily == AddressFamily.InterNetwork));
}
}
}