wincap HelloWorld
2016-10-10 14:23
274 查看
#define WIN32 #define HAVE_REMOTE #include <stdlib.h> #include "pcap.h" #include "remote-ext.h" #pragma comment(lib,"wpcap.lib") #pragma comment(lib,"ws2_32.lib") int main() { pcap_if_t *alldevs; pcap_if_t *d; int i = 0; char errbuf[PCAP_ERRBUF_SIZE]; /* 获取本地机器设备列表 */ if (pcap_findalldevs_ex(PCAP_SRC_IF_STRING, NULL /* auth is not needed */, &alldevs, errbuf) == -1) { fprintf(stderr, "Error in pcap_findalldevs_ex: %s\n", errbuf); exit(1); } /* 打印列表 */ for (d = alldevs; d != NULL; d = d->next) { printf("%d. %s", ++i, d->name); if (d->description) printf(" (%s)\n", d->description); else printf(" (No description available)\n"); } if (i == 0) { printf("\nNo interfaces found! Make sure WinPcap is installed.\n"); return 0; } system("pause"); /* 不再需要设备列表了,释放它 */ pcap_freealldevs(alldevs); }
代码是官网文档中拿来的
官网的代码有很多问题,自己改了下,可以运行vs2013
静态库和头文件路径需要自己配置
http://www.ferrisxu.com/WinPcap/html/index.html
http://www.winpcap.org/devel.htm
http://www.winpcap.org/
我下的是4.13的exe,4.12的sdk
相关文章推荐
- Maven+SpringMVC整合之helloworld
- MPI Hello World
- 第0天-制作软盘开机往屏幕上打印Hello, OS world!
- 九度OJ-1464:Hello World for U
- U-boot-1.1.4中关于hello_world.srec出错
- Python print "hello world" SyntaxError: invalid syntax
- Netty学习(二)-Helloworld Netty
- UVA 11636 - Hello World!
- HelloWorld CMake CMake中构建静态库与动态库及其使用
- Titanium Studio hello world
- Go Hello World 实例
- Cocos2d-x——HelloWorldScene.cpp的详解
- hello,world
- maven helloworld
- PAT--1031. Hello World for U
- 关于hello,world的趣闻
- SpringBoot(二):初识SpringBoot HelloWorld
- 第一个java程序"HelloWorld"
- 02-RabbitMQ Hello World Spring使用
- C++ helloworld