当前位置:网站首页>Soem EtherCAT source code analysis attachment 1 (establishment of communication operation environment)
Soem EtherCAT source code analysis attachment 1 (establishment of communication operation environment)
2022-07-05 08:04:00 【Changjiang houlang blog】
Convenience for programming and debugging needs ,windows The platform is an ideal platform .
The early code analysis will adopt the following platforms :
System environment :Win10
Compile environment :QT5.8.0
Network card communication interface installation package :WpdPack_4_1_2
QT Project code :
QT += core
QT -= gui
CONFIG += c++11
TARGET = WincapTest
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
INCLUDEPATH += $$PWD/../Wincap/Include
DEPENDPATH += $$PWD/../Wincap/Lib
LIBS += -L$$PWD/../Wincap/Lib/ -lpacket
LIBS += -L$$PWD/../Wincap/Lib/ -lwpcapThe running source code is as follows :
#include <QCoreApplication>
#include<QDebug>
#include "pcap.h"
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
pcap_if_t *alldevs;
pcap_if_t *d;
int getSize=0;
char errbuf[PCAP_ERRBUF_SIZE];
if(pcap_findalldevs(&alldevs,errbuf)==-1)
{
qDebug()<<errbuf;
}
for(d=alldevs;d;d=d->next)
{
qDebug()<<++getSize<<d->name;
if(d->description)
qDebug()<<d->description;
else
qDebug()<<"No description available ";
}
if(0==getSize)
{
qDebug()<<"No interfaces found!Make sure WinPcap is installed";
}
pcap_freealldevs(alldevs);
return a.exec();
}
The operation effect is shown below :

You can see that the computer network card prints out normally , The loaded network card catcher works normally .
边栏推荐
- Record the torch encountered by win10 cuda. is_ False problem in available()
- Global and Chinese markets for waste treatment air switches 2022-2028: Research Report on technology, participants, trends, market size and share
- Verilog -- state machine coding method
- C WinForm [get file path -- traverse folder pictures] - practical exercise 6
- How to excavate and research ideas from the paper
- Ads learning record (lna_atf54143)
- UEFI development learning 5 - simple use of protocol
- Nb-iot technical summary
- Makefile application
- Network communication model -- Network OSI tcp/ip layering
猜你喜欢

Basic embedded concepts

找不到实时聊天软件?给你推荐电商企业都在用的!

Markdown tips

Volatile of C language

Ten thousand words detailed eight sorting must read (code + dynamic diagram demonstration)
![Measurement fitting based on Halcon learning [i] fuse Hdev routine](/img/91/34c92065e797c87d6ce5ea13903993.jpg)
Measurement fitting based on Halcon learning [i] fuse Hdev routine

Network communication model -- Network OSI tcp/ip layering

C language enhancement -- pointer

Consul installation
![[trio basic tutorial 17 from getting started to mastering] set up and connect the trio motion controller and input the activation code](/img/58/576b6b77509ed7a9bef138f3899e37.jpg)
[trio basic tutorial 17 from getting started to mastering] set up and connect the trio motion controller and input the activation code
随机推荐
研究發現,跨境電商客服系統都有這五點功能!
研究发现,跨境电商客服系统都有这五点功能!
Ads usage skills
Acwing - the collection of pet elves - (multidimensional 01 Backpack + positive and reverse order + two forms of DP for the answer)
Consul installation
About yolov3, conduct map test directly
Some tips for using source insight (solve the problem of selecting all)
UEFI development learning 5 - simple use of protocol
Measurement fitting based on Halcon learning [III] PM_ measure_ board. Hdev routine
如何进行导电滑环选型
. Net service governance flow limiting middleware -fireflysoft RateLimit
[tutorial 15 of trio basic from introduction to proficiency] trio free serial communication
Define in and define out
[professional literacy] specific direction of analog integrated circuits
solver. Learning notes of prototxt file parameters
找不到实时聊天软件?给你推荐电商企业都在用的!
Adaptive filter
[trio basic tutorial 17 from getting started to mastering] set up and connect the trio motion controller and input the activation code
matlab timeserise
C, Numerical Recipes in C, solution of linear algebraic equations, LU decomposition source program