There is a lot of codes on the internet to get the public IP address but those only return one public address even if I have multiple networks adaptor. How can I get all of the public IP addresses from all of the network adaptors in windows in c#?
Asked
Active
Viewed 163 times
0
-
You probably get the IP of the adapter which is currently selected for Internet access. You would need to make Windows to connect through other adapter, wait untill connection is established and then query the IP of this adapter. – Alexey S. Larionov Jul 19 '21 at 10:15
-
I don't wanna make windows to entirely switch the connection for getting every IP. I wanna make c# to use available IP addresses as a source and make a connection to a website (like using HttpWebRequest method) that can show that network adaptors public IP address – Max Caulfield Jul 19 '21 at 10:36
-
It's good that you want it, but I think the network card on your computer might possibly have connection only through one active adapter. I'm might be wrong though – Alexey S. Larionov Jul 19 '21 at 10:50
-
It means that even though you have many adapters, you can't simply access the routers behind them (in order to get their public IP), not unless you establish the connection – Alexey S. Larionov Jul 19 '21 at 10:52
-
Whether you can even do this will depend on the machine configuration. In some cases, you have no control over which adapter is used for outgoing traffic. In the cases where it is, the duplicates explain how. – Peter Duniho Jul 19 '21 at 17:17