If I am connected to the local network here at work, I need my application to access our server using the internal IP address, otherwise I will need to use our external IP address when it is in the wild.
Currently, I'm just trying to connect through a local IP address, and then try an external one if it fails ... but the timeout takes too much time, and I was wondering if there is a way to find out in which area the computer is connected before how to try.
Edit: Patrick> Essentially, the application runs on a tablet PC that connects to the local network a couple of times a day. It is approximately equal to the number of network connections and the time that it connects locally.
All computers have a domain account when they are connected to the network (and have domain accounts with a naming convention of the type "LOCTabletx", where x is the number assigned to the machine when it is displayed.
What I'm looking for is a quick way to find out if a computer is connected to our local network or the Internet. Using Environment.UserDomainName gets a LOCTabletx, not a domain name.
EDIT
If this helps someone, I'm just trying to execute DNS. Allow the name of the machine that I can guarantee will be on the network (one of the servers). This works well enough for me.
c # networking dns
Steven evers
source share