Sample Application
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.
Application Startup
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.
Name Lookup
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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access