文件名称:ping 的源代码 网络应用
文件大小:13KB
文件格式:C
更新时间:2012-09-23 08:39:31
This sample illustrates how an
Description: // This sample illustrates how an ICMP ping app can be written // using the SOCK_RAW socket type and IPPROTO_ICMP protocol. // By creating a raw socket, the underlying layer does not change // the protocol header so that when we submit the ICMP header // nothing is changed so that the receiving end will see an // ICMP packet. Additionally, we use the record route IP option // to get a round trip path to the endpoint. Note that the size // of the IP option header that records the route is limited to // nine IP addresses.