To retrieve the file at the following URL:
http://www.myhost.com/path/file.html
First open a socket to the host www.myhost.com, port 80 (use the default port of 80 because none is specified in the URL). You can then send a request through a socket that looks like the following example:
GET /path/file.html HTTP/1.0 (Request Header Line) User-Agent: HTTP(S)Adapter (Request Header field) |
The server sends a response back through the same socket. The response could look like the following example:
HTTP/1.0 200 OK (Response Header Line) Date: Fri, 31 Dec 1999 23:59:59 GMT (Response Header Field) Content-Type: text/html (Response Header Field) Content-Length: 1354 (Response Header Field) [blank line here] <html> (Response payload) <body> <h1>Happy New Millennium!</h1> (more file contents) . . . </body> </html> |
After sending the response, the server closes the socket.