当前位置:网站首页>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/ -lwpcap
The 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 .
边栏推荐
- String judgment
- Basic embedded concepts
- UEFI development learning 5 - simple use of protocol
- Software designer: 03 database system
- Random function usage notes
- Semiconductor devices (III) FET
- [trio basic from introduction to mastery tutorial 20] trio calculates the arc center and radius through three points of spatial arc
- Introduction of air gap, etc
- Measurement fitting based on Halcon learning [III] PM_ measure_ board. Hdev routine
- UEFI development learning 6 - creation of protocol
猜你喜欢
Beijing Winter Olympics opening ceremony display equipment record 3
Solutions to compilation warnings in Quartus II
Programming knowledge -- basis of C language
Mlperf training v2.0 list released, with the same GPU configuration, the performance of Baidu PaddlePaddle ranks first in the world
Consul安装
Embedded composition and route
Wifi-802.11 negotiation rate table
UEFI development learning 2 - running ovmf in QEMU
万字详解八大排序 必读(代码+动图演示)
C, Numerical Recipes in C, solution of linear algebraic equations, LU decomposition source program
随机推荐
Class of color image processing based on Halcon learning_ ndim_ norm. hdev
Some tips for using source insight (solve the problem of selecting all)
Correlation based template matching based on Halcon learning [II] find_ ncc_ model_ defocused_ precision. hdev
Global and Chinese market of digital shore durometer 2022-2028: Research Report on technology, participants, trends, market size and share
Global and Chinese market of quenching furnaces 2022-2028: Research Report on technology, participants, trends, market size and share
VESC Benjamin test motor parameters
Beijing Winter Olympics opening ceremony display equipment record 3
Consul安装
Global and Chinese market for blood typing 2022-2028: Research Report on technology, participants, trends, market size and share
Shape template matching based on Halcon learning [VII] reuse_ model. Hdev routine
L'étude a révélé que le système de service à la clientèle du commerce électronique transfrontalier a ces cinq fonctions!
Shape template matching based on Halcon learning [v] find_ cocoa_ packages_ max_ deformation. Hdev routine
Network communication model -- Network OSI tcp/ip layering
Shape template matching based on Halcon learning [9] PM_ multiple_ dxf_ models. Hdev routine -- [read and write XLD from DXF file]
UEFI development learning 5 - simple use of protocol
Global and Chinese market of peeled bourdon tubes 2022-2028: Research Report on technology, participants, trends, market size and share
Some thoughts on extracting perspectives from ealfa and Ebeta
Ten thousand words detailed eight sorting must read (code + dynamic diagram demonstration)
Record the torch encountered by win10 cuda. is_ False problem in available()
Gradle复合构建