UDP协议解析
2016-09-20 23:04:05 0 举报
AI智能生成
TCP/IP 卷一详解版
作者其他创作
大纲/内容
11.1 Introduction
UDP is a simple , datagram oriented, transport layer protocol: each output operation by a process produces exactly one UDP datagram , which causes one IP datagram to be sent
11.2 UDP Header
Figure 11.2 shows the fields in the UDP header.
11.3 UDP Checksum
The UDP checksum covers the UDP header and the UDP data. Recall that the checksum in the IP header only covers the IP header- it does not cover any data in the IP datagram .
tcpdump Output
It is hard to detect whether a particular system has UDP checksums enabled. It is normally impossible for an application to obtain the checksum field in a received UDP header.
Some Statistics
provides count of various checksum errors on a busy NFS server that had been up for 40 days.
11.4 A Simple Example
11.5 IP Fragmentation
As we described in Section 2.8 , the physical network layer normally imposes an upper limit on the size of the frame that can be transmitted . Whenever the IP layer receives an IP datagram to send, it determines which local interface the datagram is being sent on , and queries that interface to obtain its MTU.
11.6 ICMP Unreachable Error(Fragmentation Required)
Another variation of the ICMP unreachable error occurs when a router receives a datagram that requires fragmentation, but the don't fragment flag is turned on in the IP header.
11.7 Determining the Path MTU Using Traceroute
Although most systems don't support the path MTU discovery feature, we can easily modify a version of traceroute to let us determine the path MTU.
The Worldwide Internet
As an experiment, this modified version of traceroute was run numerous times to various hosts around the world.
11.8 Path MTU Discovery with UDP
Let's examine the interaction between an application using UDP and the path MTU discovery mechanism.
11.9 Interaction Between UDP and ARP
Using UDP we can see an interesting interaction with UDP and typical implementations of ARP
11.10 Maximum UDP Datagram Size
Theoretically, the maximum size of an IP datagram is 65535 bytes, imposed by the 16-bit total length field in the IP header. With an IP header of 20 bytes and a UDP header of 8 bytes, this leaves a maximum of 65507 bytes of user data in a UDP datagram.
Datagram Truncation
Just because IP is capable of sending and receiving a datagram of a given size doesn't mean the receiving application is prepared to read that size
11.11 ICMP Source Quench Error
Using UDP we are also able to generate the ICMP "source quench" error. This is an error that may be generated by a system when it receives datagrams at a rate that is too fast to be processed.
11.12 UDP Server Design
There are some implications in using UDP that affect the design and implementation of a server.
Client IP Address and Port Number
What arrives from the client is a UDP datagram . The IP header contains the source and destination IP addresses, and the UDP header contains the source and destination UDP port number.
Some applications need to know who the datagram was sent to ,that is , the destination IP address.
UDP Input Queue
We said in Section 1.8 that most UDP servers are iterative servers. This means a single server process handles all the client requests on a single UDP port.
Restricting Local IP Address
Most UDP servers wildcard their local IP address when they create a UDP end point. This means that an imcoming UDP datagram destined for the server's port will be accepted on any local interface
Restricting Foreign IP Address
In all the netstat output that we showed earlier, the foreign IP address and foreign port number are shown as "*" meaning the end point will accept an incoming UDP datagram from any IP address and any port number.
Multiple Recipients per Port
Although it's not specified in the RFCs, most implementations allow only one application end point at a time to be associated with any one local IP address and UDP port number.
11.13 Summary
0 条评论
下一页