Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ Linux Network Programming --TCP and UDP datagram type Explanation     - expdp / impdp use version parameter data migration across versions (Database)

- Summarize small problems encountered in the use Lua (Programming)

- RedHat Linux 5.5 installation process SVN Service Notes (Server)

- Dialogue UNIX:! $ # @ *% (Linux)

- Udev: Device Manager for Linux Fundamentals (Linux)

- How to install and configure the KVM and Open vSwitch on Linux distributions (Linux)

- The most concise Systemd tutorial, just ten minutes (Linux)

- Implement binary search algorithm in C language (Programming)

- The difference between Linux su and sudo commands (Linux)

- Linux package management operations Basic entry (Linux)

- grep command Detailed and relevant examples (Linux)

- Getting jQuery - progress bar (Programming)

- About Linux iptables firewall interview questions and answers (Linux)

- Oracle Standby Redo Log experiment (Database)

- 11 examples in Linux df command (Linux)

- Bootstrap 3.3.5 release download, Web front-end UI framework (Linux)

- KVM virtualization of nested virtualization (Linux)

- bash login and welcome message: / etc / issue, / etc / motd (Linux)

- KVM usb passthrough configuration (Linux)

- Ubuntu install Liferea news subscription software (Linux)

 
         
  Linux Network Programming --TCP and UDP datagram type Explanation
     
  Add Date : 2018-11-21      
         
         
         
  TCP (Transmission Control Protocol Transmission Control Protocol) is a connection-oriented, reliable, based on the transport layer protocol byte stream.

TCP segment header has 10 required fields and one optional field. Header is at least 20 bytes. Header subsequent data is optional.

1) Source port (16)

Identification of the sending computer port or process packets. A TCP segment must include the source port number, so that the destination host should know where to send the confirmation message.

2) destination port (16)

Receiving an identification of the destination host port of a packet or process.

3) number (also called the serial number) (32)

For identifying each segment, so that the destination host to acknowledge receipt of data packets designated segment. When the source host for multiple segment sends a packet, even if the order of these packets to the destination host is not the same, the serial number is also possible to order them according to the destination host.

When SYN flag is not set, the field indicates the user data area in the first byte of the serial number; when the SYN flag is set, this field indicates the serial number of initial transmission.

The first segment at the time of establishing a connection to send, both to provide an initial sequence number. TCP standard recommended to 4ms interval increments a counter value of 1 as the initial value of the serial number. Using the counter to prevent the same serial number appears when the connection is closed and re-connection.

For segments that contain data, the number of segments in the first data byte is the initial sequence number, followed by data bytes are numbered sequentially. If the source host uses the same connection to send another segment, then the segment sequence number is equal to the previous segment sequence number to the previous segment of the number of data bytes and. For example, assume that the source host to send three segments, each segment has 100 bytes of data, and the first segment of the serial number is 1000, then the second segment of the serial number is 1100 ( 1000 + 100), and the third segment is the sequence number 1200 (1100 + 100).

If the serial number is increased to a maximum value will be reset to zero.

4) confirmation number (32)

The destination host will return confirmation number, so that the source host knows one or several segments have been received. If the ACK control bit is set to 1, then the field is valid. Serial number is equal to the value of the order is received to confirm the last segment of the serial number plus 1, which is the hope that the next destination host received message segment. After the return confirmation number, the computer thinks it has received the acknowledgment number less than all of the data.

For example, the sequence number equal to the number of the previous segment sequence number to the previous segment and the data bytes. For example, assume that the source host to send three segments, each segment has 100 bytes of data, and the first segment of the serial number is 1000, then after receiving the first segment, the destination host Back acknowledgment number 1100 containing the header. Receive the second segment (with serial number 1100), the destination host returns confirmation number 1200. Upon receipt of the third segment, the destination host returns confirmation number 1300.

Not necessarily the destination host after each received message segment return confirmation number. In the example above, the destination host may wait until all three segments are received, and then returns a confirmation number containing segment 1300, showing it has received all of 1200 bytes of data. But before then, if the destination host sends back a confirmation number you wait too long, the panel will consider the data source does not reach the destination host, and automatically re-issued.

The above example, the first segment 1000. If the destination host receives the segment number and a segment number is the last segment of 1200, it can return a confirmation number 1100, but then return confirmation number 1300 before, we should wait for segment No. 1100 intermediate segment.

5) data offset (header length) (4)

Data at the start of the TCP packet segment how far that is from the TCP header length packets at the beginning of the segment. Since the length of the TCP header with different TCP options field content changes, so the header contains a field to specify header fields. The field of 32-bit units, so the header length must be an integer multiple of 32 bits, sometimes at the end of the header 0s. If there is no TCP header options field, the header length is 5, indicating a header of 160 bits, or 20 bytes.

6) Reserved bit (6)

6 with the offset field in the data after configuration, all 0s.

7) control bit (6)

Emergency URG: this bit, indicating urgent pointer field is valid, it tells the system has urgent data in this segment, to be transmitted as soon as possible.

Confirm ACK: ACK = 1 only when the confirmation number field is valid, TCP provides segment after the connection must all convey the ACK set.

Push PSH: When two application processes for interactive communication, sometimes at one end of the application process in hope immediately after typing a command will be able to receive any response. In this case, you can use TCP push (push) operation, then the sender of the TCP PSH set and immediately create a segment sent, the recipient receives PSH = segment 1, it as soon as possible (ie "push" forward) delivered to the receiving application process, rather than wait until after the delivery of the entire cache are filled up.

Reset RST: to reset the corresponding TCP connection

Synchronization SYN: In the three-way handshake to establish a TCP connection is valid only. When SYN = ACK = 0 and 1, indicating that this is a connection request segment, if the other party agrees to establish a connection, you should use the corresponding segment of the SYN = 1 and ACK = 1. Therefore, SYN is set to indicate a connection request or connection acceptance message.

Termination FIN: used to release a connection. When FIN = 1, it indicates that the data sender of this segment has been sent, and demanded the release of the transport connection.

8) Window (16)

This field is used for traffic control, this value is the number of bytes received at this unit expects that the send window size data. Tell each other without waiting for confirmation of how much data can be sent. The maximum length shown here is 2 ^ 16--1 = 65535, such as the need to use a larger window size, use the options window scale factor option.

It refers to a segment of the newspaper to send one of the receive window (rather than send its own window).

9) checksum (16)

Source and destination hosts checksum is calculated based on the content of TCP segments and pseudo-header. It holds the length of the information from the IP header and TCP segment in the pseudo header. Like the UDP pseudo header is not transmitted over the network, and is included in the checksum pseudo-header purpose it is to prevent the destination host received in error there is a routing error datagrams.

Pseudo-header, also known as pseudo-header (Pseudo Header): refers to the TCP segment or UDP datagram format, a data packet header added to the preceding source IP address, destination IP address, protocol field of the IP packet, TCP or the total length of the UDP datagram, a total of 12 bytes, consisting of extended header structure. This pseudo header is a temporary structure that is neither up nor down pass, just to ensure that you can verify the correctness of the socket.

10) Urgent Pointer (16)

URG = 1 only when meaningful, it indicates the number of (emergency data end is the common data) newspaper paper segment urgent data byte that indicates the end position of urgent data in the packet, pay attention: You can also send urgent data even when the window is zero.

If URG is 1, the urgent pointer marks the end of urgent data. The value is the last urgent data byte serial number, serial number indicates segment offset. For example, if the segment number is 1000, the first 8 bytes of data are urgent, less urgent pointer is 8. Urgent pointer general purpose is to enable the user to abort the process.

11) option, padding field

May include "window scale factor" "timestamp" and other options. Variable length, up to 40 bytes, when no options, TCP header length is 20 bytes.

Padding is used to ensure any option 32bit integer multiple.

12) Data (variable length)

Section after the end of the TCP header

UDP packet format

UDP is the User Datagram Protocol short, the Chinese name is the User Datagram Protocol is a connectionless transport layer protocol provides transaction-oriented messaging service simply unreliable.

1) the source port (2 bytes): port number of the sender

2) destination port (2 bytes): port number of the recipient

3) packet length (2 bytes): The total length of the UDP user datagram in bytes.

4) checksum (2 bytes): detecting UDP user datagram transmission is wrong, wrong is discarded.

For the digital section and check UDP datagram containing UDP datagram header "pseudo-header."

Pseudo-header, also known as pseudo-header (Pseudo Header): refers to the TCP segment or UDP datagram format, a data packet header added to the preceding source IP address, destination IP address, protocol field of the IP packet, TCP or the total length of the UDP datagram, a total of 12 bytes, consisting of extended header structure. This pseudo header is a temporary structure that is neither up nor down pass, just to ensure that you can verify the correctness of the socket.

5) Data: UDP data portion is not even required if filled with zeros, that is, if the data length is an odd number, data length plus "a."
     
         
         
         
  More:      
 
- Smooth upgrade to OpenSSH 6.7 Procedure (Linux)
- Debian 7.7 Installation and Configuration (Linux)
- Linux Shell Scripting multithreading (Programming)
- Ubuntu comes with gedit editor to add Markdown preview widget (Linux)
- How to monitor Nginx (Database)
- Install Krita 2.8 on Ubuntu 13.10 / 12.04 / 12.10 (Linux)
- Ubuntu 10.04 to Ubuntu 10.10 Upgrade (Linux)
- To learn from scratch OpenWrt perfect tutorial (Linux)
- Performance issues under CentOS 6.5 VLAN devices (Linux)
- How to configure Apache Solr on Ubuntu 14/15 (Server)
- Using DBMS_STAT function closes mission (Database)
- CentOS 6.6 install rsync server (Server)
- gzip, bzip2, xz, tar, zip compression, archive Detailed (Linux)
- Ubuntu configuration SVN and http mode access (Server)
- Windows Remote Desktop Management CentOS 6.4 (Linux)
- Linux system monitoring tool set cpu (Linux)
- On FreeBSD 10.2 Bugzilla how to install and configure Apache SSL (Server)
- 10 Linux in the passwd command examples (Linux)
- Crawl use Wireshark packet on remote Linux (Linux)
- DBCA Error: ORA-19809: limit exceeded for recovery files process (Database)
     
           
     
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.