mirror of
https://gitlab1.ptb.de/waltem01/csharpsocketserver
synced 2024-02-04 23:19:43 +00:00
ipv4 bugfix
This commit is contained in:
parent
755f7a3639
commit
066422e796
|
@ -29,7 +29,12 @@ public static class Connection {
|
|||
try {
|
||||
string hostName = Dns.GetHostName();
|
||||
IPHostEntry entryList = Dns.GetHostEntry(hostName);
|
||||
IPAddress ipv4Entry = entryList.AddressList[0];
|
||||
IPAddress? ipv4Entry = null;
|
||||
foreach (IPAddress entry in entryList.AddressList)
|
||||
if (entry.AddressFamily == AddressFamily.InterNetwork) {
|
||||
ipv4Entry = entry;
|
||||
break;
|
||||
}
|
||||
ipAddress = ipv4Entry.ToString();
|
||||
} catch (Exception) {}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user