sockRaw = WSASocket (AF_INET, SOCK_RAW, IPPROTO_ICMP,
                         NULL, 0,WSA_FLAG_OVERLAPPED);
中,ICMP用的是IPPROTO_ICMP,TCP用的是IPPROTO_TCP,UDP用的是IPPROTO_UDP
有没有ARP、RARP协议的啊???

解决方案 »

  1.   

    these copied from MFC source codes(winsock.h)./*
     * Protocols
     */
    #define IPPROTO_IP              0               /* dummy for IP */
    #define IPPROTO_ICMP            1               /* control message protocol */
    #define IPPROTO_IGMP            2               /* group management protocol */
    #define IPPROTO_GGP             3               /* gateway^2 (deprecated) */
    #define IPPROTO_TCP             6               /* tcp */
    #define IPPROTO_PUP             12              /* pup */
    #define IPPROTO_UDP             17              /* user datagram protocol */
    #define IPPROTO_IDP             22              /* xns idp */
    #define IPPROTO_ND              77              /* UNOFFICIAL net disk proto */#define IPPROTO_RAW             255             /* raw IP packet */
    #define IPPROTO_MAX             256
      

  2.   

    可以利用ICMP的格式封装ARP协议的数据包
      

  3.   

    ?????????
      ARP is used to refer to the process of finding the hardware address and its opposite, Reverse Address Resolution Protocol (RARP). RARP finds the IP address using the hardware address. ARP is transparent to Winsock applications, but when address resolution fails, it usually causes a Winsock function error
    ///////////////////////////////////////////
    它可是比TCP,IP,UDP,ICMP..........更底層啊.
      

  4.   

    treamboy(亲月) 说的不错,
    TCP,UDP,ICMP 是基于 ip
    arp,rarp 是更底層啊,再基于 tcp\ip 的开发里没有,我还没见过。
    大慨用汇编可以写出来!