Putting them together - An example of retrieving a page
Putting them all together
We've seen both the abstract description of http and some of the details needed to use sockets. In this section we'll look at a small program that puts those two together. The program, called dump.exe will go fetch a page of html given a URL.
To run the program issue the command
dump <URL>
from the Windows 95 or NT shell. <URL> is a valid URL (I make no assurances of the programs behavior with ill-formed URLs as I didn't do much testing with them). For example:
dump http://www.w3.com/pub/WWW/
will fetch a page from the World Wide Web Consortium's web site. It puts the html into a file called dump.log (this gets overwritten with every run).
This program consists of 2 c files, 2 header files, 1 executable & 1 project usable with Visual C++ 5.0.
From the command line and will go , send data out on the network, and shutdown a socket. We've (Application Program Interface) is a set of related functions. Usually APIs come with
Missing Pieces of the Puzzle
Putting them all together
An API (Application Program Interface) is a set of related functions. Usually APIs come with