UDP and TCP, and HTTP

First, look at the TCP / IP four-layer model
      Application Layer: handles the details of a specific application, there are FTP, HTTP, TELNET, SMTP, DNS and other protocols
      The transport layer: Mainly provide end to end communication applications on both the host, the TCP protocol and the UDP protocol
      Network layer: processes the packet in the network, such as packet routing, the IP protocol, ICMP protocol, the ARP protocol, RARP protocol, and BOOTP.
      Link layer (data link layer / network interface layer): comprising a device driver in the operating system, the computer in the corresponding network interface card
HTTP
       HTTP (hypertext transfer protocol) TCP protocol to transmit information between the two computers (typically a Web server and client) is utilized. Clients use a Web browser sends an HTTP request to the Web server, Web server sends the requested information to the client. Although the HTTP protocol itself is a, but ultimately based on TCP, but, at present, it was being studied based on TCP + UDP mix of HTTP protocol.
HTTP protocol is based on a request / response model. First, establish a client and a server by TCP connection and sends a request to the server, the request contains the request method, URL, protocol version and related MIME-style message. Server responds with a status line comprising a protocol version of the message, and a failure code and the related MIME message success pattern.
       HTTP / 1.0 for every HTTP request / response establish a new TCP connection, so an HTML page content and images you will need to establish short-term multiple of the TCP link contains. A TCP connection is established will require 3-way handshake.
       In addition, in order to obtain appropriate transmission speed, TCP will need to spend extra time loop link (RTT). Every link is established need for such regular expenses, but it is not with the actual useful data, but to ensure the reliability of the link, so HTTP / 1.1 method of implementing sustainable links. HTTP / 1.1 will only establish a TCP link to use it repeatedly transmitting a series of request / response message, and thus reducing the number of regular link cost of the link establishment.
TCP and UDP
       TCP (Transmission Control Protocol Transmission Control Protocol) is a connection-oriented, reliable transport layer protocol based on a stream of bytes, when required by the network when the communication quality. For example: the accuracy of the entire data to be passed to the other side, which is often some of the requirements for reliable applications, such as file transfer protocol HTTP, HTTPS, FTP, etc., POP, SMTP and other mail transfer protocol.
UDP is the User Datagram Protocol abbreviation of User Datagram Protocol, a non-transport layer protocol connection, providing transaction-oriented messaging service simply unreliable. When the network communication quality less demanding, requiring network communication speed can be fast as possible, then you can use UDP. In daily life, the use of common application protocols such as UDP: QQ voice, QQ video, TFTP and so on.

       TCP and UDP are transport layer protocols FTP, HTTP and SMTP like to use. Although TCP and UDP are used to transport other protocols, they do have a significant difference: TCP provides guaranteed data transmission, UDP does not provide. This means that TCP has a special mechanism to ensure data security without error transmitted from one endpoint to another endpoint, but UDP does not provide any such guarantee.

More technical information may concern: gzitcast

Guess you like

Origin www.cnblogs.com/heimaguangzhou/p/11608249.html