SOEM代码Slaveinfo Demo分析2

上回写到winpcap只是在Windows上,在STM32F746上裸跑或者带系统跑时并没有

   /* we use pcap socket to send RAW packets in windows user mode*/
   *psock = pcap_open(ifname, 65536, PCAP_OPENFLAG_PROMISCUOUS |
                                     PCAP_OPENFLAG_MAX_RESPONSIVENESS |
                                     PCAP_OPENFLAG_NOCAPTURE_LOCAL, -1, NULL , errbuf);

所以参考linux下的demo

   /* we use RAW packet socket, with packet type ETH_P_ECAT */
   *psock = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ECAT));

猜你喜欢

转载自blog.csdn.net/wofreeo/article/details/89307265
今日推荐