About HTTP and TCP/IP

Source: Internet
Author: User

One, TCP/IP

Concept: TCP/IP is the general name of all kinds of Internet-related protocol families.

The TCP/IP protocol family is divided into 4 layers, application layer, transport layer, network layer and data link layer.

Application layer:

The activity that determines the communication when an app service is provided to the user. All kinds of common application services are stored in the TCP/IP protocol family. For example, FTP (File Transfer Protocol) and DNS (domain Name System) Services are two of these. The HTTP protocol is also in this layer.

Transport Layer:

For the upper application layer, provides data transfer between two computers in a network connection.

There are two different protocols in the Transport Layer: TCP (Transmission Control Protocol) and UDP (User Datagram Protocol).

Network layer:

Handles packets that flow over the network. A packet is the smallest unit of data transmitted over a network. This layer specifies the path to the other computer and sends the packets to each other. The IP internetwork Protocol is located at this level.

Link Layer:

The hardware part used to process the linked network. This includes physical visible parts such as control of the operating system, device drivers for hardware, NICs (network adapters, NICs), and fiber optics.

TCP is full-duplex, that is, the client sends information to the server side, the server can also send messages to the client. And half-duplex means that a can give B, B can also give a, but a in the B hair, B can not give a, that is, not at the same time, half duplex. Single-duplex can only be sent to b,b cannot be sent to a, or only B to a,a cannot be sent to B.

When creating a TCP connection, the three-time handshake:

    • The sending side sends a packet with a SYN flag to the receiving end.
    • When received, a packet with a syn/ack flag is sent back to convey the confirmation message.
    • Finally, the sending end returns a packet with an ACK flag, which represents the end of the handshake.

Four handshake when disconnecting a TCP connection, e.g. client data is sent out, need to disconnect

    • The client sends a FIN to the server, the client =>fin_wait1 (shuts down the client-to-servers connection)
    • After the server receives fin, it sends back an ACK. Service-Side =>close_wait
    • The server sends a fin to the client. Server-side =>last_ack (Close servers to client links)
    • The client receives fin and then returns an ACK. Client =>time_wait, Server =>close

Here, the client is closed first, the active shutdown is performed, and the other side performs a passive shutdown. In the last handshake, after the client sends an ACK, it enters time-wait, and the CP link is not released, and then the client enters the close state after the 2MSL of time waits for the timer setting. 2MSL is the maximum time the message exists

Reference Document: http://blog.csdn.net/guyuealian/article/details/52535294

About HTTP and TCP/IP

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.