Network Programming in .NET: With C# and Visual Basic .NET

HTTP operates on TCP/IP port 80 and is described definitively in RFC 2616. The protocol is quite straightforward. The client opens TCP port 80 to a server, the client sends an HTTP request, the server sends back an HTTP response, and the server closes the TCP connection.
The simplest HTTP request is as follows:
GET /
| Tip | On some servers, it is necessary to specify the DNS name of the server in the GET request. |
This request will instruct the server to return the default Web page; however, HTTP requests are generally more complex, such as the following:
GET / HTTP/1.1Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,application/vnd.ms-powerpoint, application/vnd.ms-excel,application/msword, */*Accept-Language: en-gbAccept-Encoding: gzip, deflateUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT5.1; .NET CLR 1.0.3705)Host: 127.0.0.1:90Connection: Keep-Alive
This tells the server several things about the client, such as the type of browser and what sort of data the browser can render.
Table 4.1 shows a complete list of standard HTTP request headers are as follows:
| HTTP header | Meaning |
|---|---|
| Accept | Used to specify which media (MIME) types are acceptable for the response. The type */* indicates all media types and type/* indicates all subtypes of that type. In the example above, application/msword indicates that the browser can display Word documents. |
| Accept-Charset | Used to specify which character sets are acceptable in the response. In the case where a client issues Accept-Charset: iso-8859-5, the server should be aware that the client... |