1-) C# RMOS - bağlı olduğum ipv4 adresini alma get local ipv4 copy kopyalama
uygulama indirme linki : https://drive.google.com/file/d/12SGWn6mIsMYJzyPqVuoaYoSMbnfKNw4y/view?usp=sharing
private void Form1_Load(object sender, EventArgs e)
{
string ipm = GetLocalIPAddress();
Clipboard.SetText(ipm);
MessageBox.Show("Local ip'niz kopyalandı...\n\nİP : "+ipm);
this.Close();
}
public static string GetLocalIPAddress()
{
if (!System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
{
return "internete bağlı değil";
}
string localIP;
using (Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, 0))
{
socket.Connect("8.8.8.8", 65530);
IPEndPoint endPoint = socket.LocalEndPoint as IPEndPoint;
localIP = endPoint.Address.ToString();
return localIP;
}
}
DİĞER
public static string GetLocalIPAddress() {
var host = Dns.GetHostEntry(Dns.GetHostName());
foreach (var ip in host.AddressList) {
if (ip.AddressFamily == AddressFamily.InterNetwork) {
return ip.ToString();
}
}
throw new Exception("No network adapters with an IPv4 address in the system!");
}
KAYNAK : https://www.web-gelistirme-sc.com/tr/c%23/yerel-ip-adresini-al/940525101/