如何在c++ builder中使用win32 API函数将网卡设置为混杂模式?

njiceshihong8 2003-10-09 10:09:03
如何在c++ builder中使用win32 API函数将网卡设置为混杂模式?
在linux中可以使用以下程序:
int Set_Promisc(char *interface, int sock ) {  
struct ifreq ifr;      
strncpy(ifr.ifr_name, interface,strnlen(interface)+1);
if((ioctl(sock, SIOCGIFFLAGS, &ifr) == -1)) {  
/*Could not retrieve flags for the interface*/
perror("Could not retrive flags for the interface");
exit(0);
} 
printf("The interface is ::: %s\n", interface);  
perror("Retrieved flags from interface successfully");
ifr.ifr_flags |= IFF_PROMISC;  
if (ioctl (sock, SIOCSIFFLAGS, &ifr) == -1 ) {  
/*Could not set the flags on the interface */  
perror("Could not set the PROMISC flag:");
exit(0);    
}
printf("Setting interface ::: %s ::: to promisc",interface);
return(0);
}
在windows环境下应该如何进行??
...全文
69 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
del77 2003-10-13
  • 打赏
  • 举报
回复
WINDOWS下要写个驱动的,不过也可以用WINPACP库.的驱动

1,316

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder 网络及通讯开发
社区管理员
  • 网络及通讯开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧