I'm doing a client and server program and I am having issues getting my computer's local IP address.
Dns.GetHostAddresses(Dns.GetHostName()); returns 2 addresses for me. My computer is behind a router with 2 others on the network. The code returns 192.168.1.2 (I know this is my computer), and 192.168.56.1 (I have no idea what this is.)
If that code returns more than one address, how can I test to see which one belongs to the computer the server is running on?
Also, I had originally tried to have my server listen for connections on my computer's external IP, but for some reason it kept complaining that the format wasn't correct. I couldn't figure out why, because it looked fine to me. So I did the above.
But if my client is running on another network, tries to send data to my computer's external IP (27.432.810.410; not real), and my server is listening on my computer's local IP (192.168.1.2), that's not going to work. Or will it??