The first thing to look at is TCP/IP protocol, which involves four layers: link layer, network layer. Transport layer, application layer.The data frame of the Ethernet (Ethernet) in the link layerIP packets on the network layerTCP or UDP packets in the transport layerdata in TCP or UDP is in the application tierTheir relationship is the data frame {
Finally, we finally came to the large header TCP protocol. In order to provide reliable transmission services for the application layer, various mechanisms are designed for tcp to achieve possible errors during transmission, such as packet loss, retransmission, disordered order, and link transmission errors.
1. TCP Overview
First, let's take a look at the header
and slice
The first digit is not used. Every two DF (don't fragment) bits are 1. If the transmitted datagram exceeds the maximum transmission unit, the datagram is discarded, and sends an ICMP error message. The third-digit MF (more fragment) indicates whether more slices exist. The value of this parameter is 1, indicating that more fragments exist in the future. The last mf is 0.After an IP packet is split, each datagram has its own header, but the
Plot? Tcp / ip? Sixth chapter? TCP vs. UDP? Note 6.1 The role of the transport layer?The transport layer must indicate this specific program, in order to achieve this function, use the port number of such an identification code. Depending on the port number, it is possible to identify specific programs that are all processed by the application layer on the transp
:
Figure 2 TCP Message format
Source and target ports
It is used for Multiplexing/multi-channel decomposition of data from or from the top layer application. It can be understood that a port is used to identify different processes of the same computer.
Serial number and confirmation number
These two fields are the key part of the TCP reliable transmission servic
of the TCP packet is as follows:
Figure 2 TCP Message format
Source and target ports
It is used for Multiplexing/multi-channel decomposition of data from or from the top layer application. It can be understood that a port is used to identify different processes of the same computer.
Serial number and confirmation number
These two fields are the key part of the
Libnids is a library for network security and can be used to detect attacks on the network. The most valuable part is that it simulates the Layer 3 and Layer 4 protocol stacks in the Linux kernel. We can further study the TCP/IP protocol stack in the Linux kernel for some valuable reference. Here is a brief introduction to the implementation details of the layer 3 and Layer 4
the server to which it is connecting, indicate the address and port number of the server-side socket, and then make a connection request to the server-side socket.Connection confirmation: When the server-side socket supervisor hears or says that a connection request for a client socket is received, in response to the client socket request, create a new thread, the server-side socket description to the client, once the client confirmed this description, the two sides formally establish a connect
applications to interact with TCP/IP protocols. The application layer and the transport layer can use Socket interfaces to distinguish between processes or network connections of different applications to implement concurrent data transmission services.
3.2 establish a socket connection
To establish a Socket connection, you must have at least one Socket. One of
-side socket. To do this, the client's socket must first describe the socket of the server it is connecting to, indicate the address and port number of the server-side socket, and then make a connection request to the server-side socket. Connection confirmation: When a server-side socket hears or receives a connection request from a client socket, it responds to a client socket request, establishes a new thread, sends a description of the server-side socket to the client, and once the client co
Finally see the TCP protocol, this is the TCP/IP detailed inside the most important is the most exciting part, it will take great effort to read. The previous TFTP and BOOTP are simple protocols, no notes, no writing.
TCP and UDP are at the same level---transport layer, but
The differences between TCP, IP, HTTP, and SOCKET and the connection network are classified as follows: corresponding to the physical layer -- data link layer -- network layer -- IP protocol transmission layer -- TCP protocol Session Layer -- presentation layer and application layer -- HTTP protocol www.2cto.com socket
what it wants toThe socket for the connected server, indicating the address and port number of the server-side socket, and then making a connection request to the server-side socket. Connection confirmation: When a server-side socket hears or receives a connection request from a client socket, it responds to a client socket request, establishes a new thread, sends a description of the server-side socket to the client, and once the client confirms the description, the two parties formally estab
Finally, I saw the TCP protocol. This is the most important and exciting part of the TCP/IP explanation. It takes a lot of effort to read it. The previous TFTP and BOOTP are both simple protocols, so you don't need to take notes.TCP and UDP are on the same layer-transport layer, but the most difference between
1 What's all this?
Since it is a network transmission, involving several systems, the first thing to consider is how to accurately navigate to one or several hosts on the network, and the other is how to reliably and efficiently
of data transfer. The TCP/IP protocol will be used here. 1.1 TCP/IP protocol group
The
then generates a retransmission request that can reorder packets received in order5. Session Layer: Managing the session between hosts, including session setup, termination, and management during sessions, transmission units (SPDU)6. Presentation layer: Transform the data transmitted by the network, so that the information transmitted between multiple hosts can understand each other, including data compression, encryption, format conversion, etc., Transmission Unit (PPDU)7. Application layer: T
" approach, the server can not only reply to the data until the request is made, but the client needs to make a request to the server. In many cases, the server side is required to proactively push data to the client, keeping the client and server data in real-time and synchronization. At this point, if the two sides established a socket connection, the server can directly transfer the data to the client, if the two sides establish an HTTP connection, the server needs to wait until the client s
Analysis of TCP/IP protocol families in iOS Socket, iostcpIntroduction
This article mainly reviews TCP/UDP, HTTP, and Socket in the TCP/IP protocol family.(-- This article is very dry and has been brewing for a long time! Can you watch it patiently? O_o)
In this article, I
proactively push data to the client, keeping the client and server data in real time and in sync. At this point, if the two sides established a socket connection, the server can directly transfer the data to the client, if the two sides establish an HTTP connection, the server needs to wait until the client sends a request before the data can be sent back to the client, so the client periodically sends a connection request to the server, not only to remain online, It also asks the server if the
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.