-
ICMP 如何区分请求 - [Thinking]2009-08-06
版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
http://opendream.blogbus.com/logs/43631299.html
最近思考一个问题,发送一个ping请求(ICMP ECHO)出去,操作系统收到回应(ICMP relay)后如何来区分属于哪个ICMP ECHO?
RFC 792对此有详细的说明:
Echo or Echo Reply Message
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Code | Checksum |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Identifier | Sequence Number |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Data ...
+-+-+-+-+-.........
Identifier
If code = 0, an identifier to aid in matching echos and replies,
may be zero.Sequence Number
If code = 0, a sequence number to aid in matching echos andreplies, may be zero.
Description
The data received in the echo message must be returned in the echo
reply message.
The identifier and sequence number may be used by the echo sender
to aid in matching the replies with the echo requests. For
example, the identifier might be used like a port in TCP or UDP to
identify a session, and the sequence number might be incremented
on each echo request sent. The echoer returns these same values
in the echo reply.
Code 0 may be received from a gateway or a host.看来区分这些是通过 Identifier和 Sequence Number来区分的.
如果你想对ICMP了解更多,访问:http://www.faqs.org/rfcs/rfc792.html
收藏到:Del.icio.us








评论
I received my<a href="http://www.buddyugg.com/"><strong> ugg boots</strong></a> today, very impressed. They are like sort of a massive slipper, soft, easy to wear and light.