原来的贴子:
http://expert.csdn.net/Expert/topic/2005/2005138.xml?temp=.4845697
开始,一个头文件找不到,将#include <mstcpip.h> 换成 #include <Ws2tcpip.h>
然后将好多段代码重新敲了一面。
最终出现了如下这个错误:
D:\netcapture\netcapture.cpp(153) : error C2065: SIO_RCVALL : undeclared identifier
对应的代码:
iErrorCode=WSAIoctl(SockRaw,SIO_RCVALL,&dwBufferInLen,sizeof(dwBufferInLen),
&dwBufferLen,sizeof(dwBufferLen),&dwBytesReturned,NULL,NULL);
我仔细看了SIO_RCVALL好几眼,还是看不出问题。
我也不知道这个联接的source是否真的调试通过,我确实也仔细读了
这个代码,帮忙look一下。
你没装psdk,所以找不到<mstcpip.h> ,你不能用<Ws2tcpip.h>替换<mstcpip.h>
#include <Mstcpip.h>
去微软网站下SDK也就是PSDK,
我刚下了完整的300多M,完全安装1。4G!!!
SIO_RCVALL大概是只有windows2000以上才支持,所以你要在stdafx.h中定义
In order to access Win2000 specific APIs etc, one needs the following #define in the applications stdafx.h (before any other #includes)
#define _WIN32_WINNT 0x0500
那里用到装那东西,不就是个宏?
自己写一下连include <mstcpip.h>都不用了 给你mstcpip.h 源文件自己存成 mstcpip.h
再给你片文章
http://www.csdn.net/develop/article/13/13890.shtm
//*************************************************************************//
//* Header File: mstcpip.h
//*************************************************************************//
// Copyright (c) Microsoft Corporation. All rights reserved.
#if _MSC_VER > 1000
#pragma once
#endif
/* Argument structure for SIO_KEEPALIVE_VALS */
struct tcp_keepalive {
u_long onoff;
u_long keepalivetime;
u_long keepaliveinterval;
};
// New WSAIoctl Options
#define SIO_RCVALL _WSAIOW(IOC_VENDOR,1)
#define SIO_RCVALL_MCAST _WSAIOW(IOC_VENDOR,2)
#define SIO_RCVALL_IGMPMCAST _WSAIOW(IOC_VENDOR,3)
#define SIO_KEEPALIVE_VALS _WSAIOW(IOC_VENDOR,4)
#define SIO_ABSORB_RTRALERT _WSAIOW(IOC_VENDOR,5)
#define SIO_UCAST_IF _WSAIOW(IOC_VENDOR,6)
#define SIO_LIMIT_BROADCASTS _WSAIOW(IOC_VENDOR,7)
#define SIO_INDEX_BIND _WSAIOW(IOC_VENDOR,8)
#define SIO_INDEX_MCASTIF _WSAIOW(IOC_VENDOR,9)
#define SIO_INDEX_ADD_MCAST _WSAIOW(IOC_VENDOR,10)
#define SIO_INDEX_DEL_MCAST _WSAIOW(IOC_VENDOR,11)
// Values for use with SIO_RCVALL* options
#define RCVALL_OFF 0
#define RCVALL_ON 1
#define RCVALL_SOCKETLEVELONLY 2