HTTP


Hypertext Transfer Protocol (HTTP) is undoubtedly one of the most popular protocols today. HTTP is the underlying protocol on which the World Wide Web is built. HTTP is internally built on TCP/IP, a combination of two lower-level protocols (Transmission Control Protocol and Internet Protocol.

HTTP is used to deliver files, images, sounds, or any other kind of data (collectively known as resources) over the Internet. URLs (Uniform Resource Locators) serve as global addresses to identify these resources. HTTP generally uses port 80 for its operation.

This is how HTTP works:

  1. An HTTP client opens a HTTP connection to the server whose services are required.

  2. The client sends an HTTP request to the server. Requests are generally to access resources.

  3. The server sends an HTTP response back to the client. The response might contain the requested resource or any other information to be sent back to the client.

  4. The connection is then closed.

It is also possible to send multiple requests and responses over the same TCP/IP connection. In such cases, the requests and responses are said to be pipelined.

Note

Pipelining was made possible only after HTTP 1.1, prior to which every request/response used to necessitate a new TCP/IP connection and was therefore inefficient.


HTTP requests and responses share a similar format. Both these messages consist of

  1. An initial line

  2. Zero or more header lines

  3. A blank line or CRLF (Carriage Return/Line Feed)

  4. An optional message body containing data

HTTP is a stateless protocol, as no state information is stored between two successive message transfers. The beauty of the protocol is its simplicity. The protocol defines just a few basic operations that a client can invoke on a server (GET and POST are the most commonly used ones), yet it has been extended to make possible thousands of complex interactions taking place on the Internet today..

HTTP for P2P

A large number of P2P applications use HTTP as an underlying transport mechanism. The ubiquitous nature of HTTP is the most important reason for this. Being the most extensively used protocol on the World Wide Web, any application that uses HTTP can be sure to appeal to a large base of users. HTTP is also the safest bet when you expect your application to be used in a variety of environments. The reason for this is that many environments, especially corporate environments, have firewalls that restrict network traffic coming in and going out their domain. These firewalls normally permit HTTP traffic to pass through because HTTP traffic generally caters to Web users who surf the Internet.

This is the also the reason why many popular instant messaging and file sharing applications use HTTP underneath. Often, these applications avoid violations of corporate policies as well as copyright laws. HTTP acts as a convenient means by which such applications can act in a stealth mode.

Therefore, if you decide to use HTTP applications, you need to evaluate the intent of your application. Is it meant to help anonymity and stealth? If the answer is yes, then HTTP is your best bet. Is it meant to be an enterprise application? If so, then why do you really need HTTP? Isn't it much better to use your customized protocol and let the network administrator configure the network for its use?



JavaT P2P Unleashed
JavaT P2P Unleashed
ISBN: N/A
EAN: N/A
Year: 2002
Pages: 209

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net