为什么下面语句编译通不过,是不是winsocket不支持?
怎么解决?谢谢
setsockopt(sockfd,IPPROTO_IP,IP_HDRINCL,&on,sizeof(on));

解决方案 »

  1.   

    on = TRUE;
    err = setsockopt(sockfd, IPPROTO_IP, IP_HDRINCL, (char*)&on, sizeof(on));
    这个能用!你试一试!
      

  2.   

    不是,我的vc 6 professional 不认识选项IP_HDRINCL
      

  3.   

    winsock programmer's FAQThese stacks do not support raw IP or "packet capturing" from the Winsock layer.
    Notice that raw TCP and UDP ar'nt possible directly under Winsock 2. Instead ,
    you  must  use IP_HDRINCL and build your own IP and TCP or UDP headers.
    Under Windows NT and Windows 2000,only userss that are members of the Administrator group can open raw sockets.
      

  4.   

    看到了,win2000应该支持的,但是我的程序编译通不过啊?
    怎么办?
                   Winsock 1.1        Win9x with    WinNT 4.0    Windows 2000 
                   (all platforms)      Winsock 2 
     Raw I[CG]MP        No              Yes          Yes          Yes 
    IP_HDRINCL           No             No           No           Yes 
    Raw TCP/UDP         No              No           No            No 
         
      

  5.   

    哦,解决了,原来IP_HDRINCL定义在文件Ws2tcpip.h中