Difference between TCP and UDP protocols and protocol and TCP / IP protocol connection TCP / IP protocol (a) networking basics

What is the introduction to the first TCP, what is UDP.

 

1. What is TCP?

TCP (Transmission Control Protocol, Transmission Control Protocol) is connection-oriented and reliable the byte stream service, that is, before the send and receive data, a reliable connection must be established and each other. This process and a similar call: Dial the ringing first, wait for the other to answer the phone, say hello, say who you are. In the Internet protocol suite (Internet protocol suite) in, TCP layer is located above the IP layer below the application layer is the transport layer.

 

Connection-oriented

 

2. What is UDP?

UDP (User Datagram Protocol, User Datagram Protocol), is the OSI (Open System Interconnection, Open Systems Interconnection) reference model of one non-connection of the transport layer protocol that provides transaction-oriented simply unreliable messaging service, prior to transmission of data and a source terminal connection is not established , when it wants to transmit data is simply to grab from the application, and as quickly as possible to throw it on the network, it is also unsafe .

 

Connectionless

 

 

3. TCP three-way handshake process?

1, contains a host A to host B by sending a data segment sync flag serial number to the host B, B to establish a connection request to the host through the data segment, Host A Host B to tell two things: I want you communications; which you can use to respond to my serial number as the starting segment.

2, Host B Host A request is received by a data segment with the acknowledgment (ACK) and synchronous serial number (SYN) flag in response to Host A, Host A also told two things:
  First: I have receipt of your request, your data can be transferred;

  The second is: what you are using Leica serial number as the initial data segment to respond to me;

3, Host A receives the data segment, and then sends an acknowledgment reply confirming the receipt of the data segment host B: "I have received a reply, I now want to start the actual data transmission";

 

Such 3-way handshake is complete, Host A and Host B can transmit the data.

 

3-way handshake is characterized by:

  • No application layer data;
  • The SYN flag only if the TCP connection construction production will be set;
  • After the handshake is complete the SYN flag bit is set to 0;

 

4. TCP four times waved process?

TCP connection is established to conduct 3-way handshake, and disconnect to be 4 times

1, when the host A data transfer is complete, set the control bits FIN 1, stop request made TCP connection;
2, after receiving the host B FIN response thereto, to confirm the TCP connection will be closed in that direction, the ACK is set 1;
3, then the B end requests made off in the opposite direction, sets FIN 1;
4, host a requests the host B to be confirmed, is set to ACK, both to the closed end;

 

【Glossary】

  • One control bit ACK TCP header, the data acknowledgment. Confirmation issued by the destination, using it to tell the end of data period before transmitting the sequence numbers are received. For example, the acknowledgment number is X, the X-1 represents the front segments of data are received, only when ACK = 1, an acknowledgment number is valid, if ACK = 0, the acknowledgment number is invalid, then will retransmit the data required, ensure data integrity;
  • SYN synchronization sequence number, TCP connection establish the position 1;
  • FIN bit to finish sending the transmitting end, when the data transfer is completed to disconnect TCP, one of these proposed a disconnected position;

 

As can be seen off by the TCP three-way handshake and four times:

TCP uses a connection-oriented communication, greatly improving the reliability of data communication, the transmission data and receiving side have a formal interaction before data transmission, the transmission data is formally laid a reliable basis.


5. TCP and UDP difference of?

. 1, the TCP -based connection , the UDP-based connectionless 's; 

2, the requirements on system resources: TCP more (TCP packet has 20 bytes), UDP less (UDP packets only 8 bytes); 

3, UDP program structure is relatively simple

4, TCP is a byte-stream mode , while UDP is a datagram mode ;

5, TCP to ensure data accuracy, safety and reliability , and guarantee data order , while UDP might packet loss , and UDP does not guarantee data order .

 

 

reference:

1.  face questions: the difference between TCP and UDP protocol agreement

 

6. Following is a brief talk about the difference between TCP, UDP and TCP / IP protocols:

TCP / IP protocol is a protocol suite . Which includes many protocol. UDP is just one of them. Reason why the name TCP / IP protocol because TCP, IP protocols are two very important agreements, on his two named.

TCP / IP protocol suite comprises an application layer, transport layer, network layer, the network access layer .

The application layer includes:

  • Hypertext Transfer Protocol (HTTP): The basic protocol of the World Wide Web.   
  • File transfer (TFTP Trivial File Transfer Protocol):   
  • Remote login (Telnet), providing remote access to a host of other features, it allows users to log     
  • internet host and execute commands on this host.    
  • Network Management (SNMP SNMP), the protocol provides a method for monitoring network devices, as well as configuration management, statistics collection, performance management and security management.   
  • Domain Name System (DNS), the system is used to convert an IP address in the network node in the internet domain name and public broadcasting. 

The network layer comprises:  

  • Internet Protocol (IP)     
  • Internet Control Message Protocol (ICMP)    
  • Address Resolution Protocol (ARP)    
  • Reverse ARP (RARP)  

Network Access Layer:

Also referred to as a host to the network layer (host-to-network).

Network access layer functions include:

  • IP addresses and physical addresses of the mapping hardware;
  • The IP encapsulated into frames.

Access different hardware-based type of network interface, and the network layer defines the physical medium connected.

 

The following is a protocol layer model diagram from top to bottom:

And the function corresponding to each layer:

 

 There is in the application layer, presentation layer and session layer protocol used:

 

 

reference:

1. The difference between TCP and UDP protocol agreement

 2. Zhang - TCP / IP protocol (a) knowledge of network infrastructure , in great detail, with vividly;

 

Guess you like

Origin www.cnblogs.com/gjmhome/p/11423935.html