In this chapter, we extend
FtpView to allow the
user to look up hosts by name or address and services by name. We
extend our library of wrapper functions around the Net Library API to
provide hostname, address, and service resolution. First, let’s
look at the changes to the program from the user’s perspective.
When the application starts, it initializes the Net Library. The results of this initialization are displayed on the screen, as shown in Figure 7-5.
Figure 7-5. Initial screen of sample application
This screen is similar to the initial screen in the previous version. The Open and Close buttons have been deleted, replaced with three new buttons: Name, Address, and Service. These buttons allow you to look up hosts, address, and services by name, respectively.
When you select the “Name” button, the application displays a dialog that allows you to enter a hostname as shown in Figure 7-6.
Figure 7-6. Name lookup dialog
Enter the hostname and select “OK.” The application then attempts to look up the host information associated with that name.
The application does not connect to the network until a network request is made. Hostname resolution is a network request. If the user is not yet connected to the network, the application warns ...