Code
IPAddress GetIP() { foreach (IPAddress ip in Dns.GetHostEntry(Dns.GetHostName()).AddressList) if (ip.AddressFamily == AddressFamily.InterNetwork) return ip; return null; }
Reference
How to get the IP address of the server on which my C# application is running on?
沒有留言:
張貼留言