Hi there!
Maybe there is someone who can help me with my problem:
Are there any functions in C#, to read the IP Adress from the Computer where the App is running?
(There MUST be a way!)
Try this solution from Tom Archer and Andrew Whitechapel:
using System;
using System.Net;
class Workstation
{
public Workstation()
{
IPAddress ipAddress = Dns.Resolve(HostName).AddressList[0];
IPAddressString = ipAddress.ToString();
}
public const string HostName = "Your Machine name";
public readonly string IPAddressString;
}
class GetIpAddress
{
public static void Main()
{
Workstation workstation = new Workstation();
Console.WriteLine("The IP address for '{0}' is {1}", Workstation.HostName,
workstation.IPAddressString);
}
}
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.