/* 打开选择的网卡 */
if ( (fp = pcap_open_live(d->name, // 设备名称
65536, // portion of the packet to capture.
// 65536 grants that the whole packet will be captured on all the MACs.
0, // 如果是 1就是混杂模式
1000, // 读超时为1秒
errbuf // error buffer
) ) == NULL)
{
fprintf(stderr,"\nUnable to open the adapter. %s is not supported by WinPcap\n");
pcap_freealldevs(alldevs); /* Free the device list */
return -1;
}