Linux Socket Programming by Example - Warren Gay

< BACKCONTINUE >
159231153036212041242100244042145096184016146223183074028121223009001092198022040160148000048

Chapter 9. Hostname and Network Name Lookups

It is the noon hour and the battle of your morning meetings and issues has been subdued for the moment. The silence of the cubicles is maligned by the rattle of your brown-bag lunch. Your Netscape browser springs to life, after an entire morning of standing by in a minimized state. You tap out a few keystrokes http://206.43.198.67 and press ENTER. Huh?

What's wrong with this picture? It was the IP number 206.43.198.67, wasn't it? After all, what site is that? You likely know this as the site http://www.lwn.net instead, where you get your Linux Weekly News (at least at the time of this writing).

Your associate at work won't ask you to ftp some source code from ftp site 152.2.254.81, will he? Instead, he'll ask you to ftp from sunsite.unc.edu. As you know, IP numbers are simply not easy to remember. In this chapter, you will learn

  • How to determine your local hostname

  • How to resolve a hostname into an IP number

  • How to resolve an IP number into a hostname

Once you have completed this chapter, you will be able to use hostnames or IP numbers in your client and server programs.

< BACKCONTINUE >