I have a linux (ubuntu server 14.04) machine with 250 ips. When I run my c# code in mono, it only retrieves 50 ips.
All ips are configured correctly, I have the same code in java, and all 250 ips are found, and can be bound to.
I have tried:
Dns.GetHostByName(Dns.GetHostName()).AddressList;
and
Dns.GetHostAddresses(string.Empty);
both return 50 ips?
So, my question, is there a limit in c# on how many ips can be discovered? or any other reason anyone knows of why this would be happening?
I would recommend switching to a different method to obtain the same data.
System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()
http://msdn.microsoft.com/en-us/library/system.net.networkinformation.networkinterface.getallnetworkinterfaces%28v=vs.110%29.aspx
What you are asking the code to do is to take the current machine, and ask a second server what all IP addresses are registered. Instead it would be easier, and more reliable, to ask the server you are on what the IP addresses are. Some may not be registered to a DNS server, either local, or remote.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With