![]() |
伤情的充电器 · jdbcTemplate学习(一) - ...· 1 年前 · |
![]() |
大气的海龟 · 关于配置文件 - PowerShell | ...· 1 年前 · |
![]() |
温暖的酱牛肉 · 微信小程序连接蓝牙打印机打印图片示例 - 掘金· 1 年前 · |
![]() |
温暖的酱牛肉 · 微信小程序连接蓝牙打印机打印图片示例 - 掘金 1 年前 |
#ifdef WIN32
#include <sys time.h="">
#else
#include <time.h>
#endif
#include "pcap.h"
#include "pcap/bpf.h
#include <stdio.h>
int main()
{
pcap_if_t *alldevs;
pcap_if_t *d;
int i=0;
char errbuf[PCAP_ERRBUF_SIZE];
/* Retrieve the device list from the local machine */
if (pcap_findalldevs_ex(PCAP_SRC_IF_STRING, NULL, &alldevs, errbuf) == -1)
{
cout << "Error in pcap_findalldevs_ex: %s\n";
return 0;
}
/* Print the list */
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;
}
/* We don't need any more the device list. Free it */
pcap_freealldevs(alldevs);
return 0;
}