PortScanner 我运行时遇到的常见的错误

来源:互联网 发布:数据库第三范式 编辑:程序博客网 时间:2024/05/30 23:02

PortScanner下载地址:http://www.codeguru.com/cpp/i-n/network/tcpip/article.php/c7535/Port-Scanner.htm

环境:vc6.0, xp系统

错误一:Iphlpapi.h 不存在的问题,

解决方法:你可以在csdn里下载,再在目录里加载,包括库文件和include 文件,

错误二:error C2664: 'pcap_next_ex': cannot convert parameter 3 from 'unsigned  > char ** ' to 'const unsigned char *

解决方法:把函数pcap_next_ex的第三个参数的定义前加const 就可以。

 Yeah, I just got the same problem, so I changed the declaration:  
"u_char *pkt_data;" to "const u_char *pkt_data;" 
 
 It works just fine. However, I dont know if it is the correct way. 

Given that the "const" in the declaration of "pcap_next_ex()" is an  
indication that there's no guarantee that you'll be allowed to write  
to the packet data or that Bad Things won't happen if you write to it  
- i.e., it's an indication that you shouldn't write to it (if you  
want to modify the packet data, copy it and modify the copy) -  
declaring the pointer to the packet data as a pointer to "const  
u_char" is the right thing to do.

原创粉丝点击