Now that you know a little bit about how the Internet works, you might be interested to see what kind of information is available to your application about the particular networking environment the application is operating in. One of the most important sources of information is the Network object, which is accessible as a member of the System object. It can tell you if you are currently connected to a network by using this property: System.Network.IsConnected as Boolean It can also look up your network address. The networks based on TCP/IP assign a unique number to every individual computer on the network. This is known as the IP address, and it looks like this (this is the default IP address of the current machine you are on, and is the IP address we will be using later on in the sample application): 127.0.0.1 This IP address can also be referred to by name, which is called a domain name. The domain name that is paired with this IP address is LocalHost You can look up both domain names and IP addresses of the computer the application is running on with the Network object using the following methods. Note that REALbasic calls the domain name the DNS address: System.Network.LookupDNSAddress(DNSAddress as String) as String System.Network.LookupIPAddress(IPAddress as String) as String If you use LookupDNSAddress, you pass a domain name, and it will return the IP address for that domain. The LookupIPAddress works in the opposite directionyou pass it an IP address and it returns a domain name for it. To get the IP address for the current computer, you need to access the NetworkInterface class, which is also available from the System object. |