当前位置:网站首页>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 .
边栏推荐
- Relationship between line voltage and phase voltage, line current and phase current
- PMSM dead time compensation
- Halcon's practice based on shape template matching [1]
- Shape template matching based on Halcon learning [9] PM_ multiple_ dxf_ models. Hdev routine -- [read and write XLD from DXF file]
- Bootloader implementation of PIC MCU
- Reasons for rapid wear of conductive slip rings
- Global and Chinese markets of nano biosensors 2022-2028: Research Report on technology, participants, trends, market size and share
- Makefile application
- 2021-10-28
- [trio basic tutorial 16 from introduction to proficiency] UDP communication test supplement
猜你喜欢

Software designer: 03 database system

The firmware of the connected j-link does not support the following memory access

Create inf module in AMI code
![Halcon's practice based on shape template matching [1]](/img/68/206eed7502fbf108a929aa9365b1ae.jpg)
Halcon's practice based on shape template matching [1]

How to migrate the device data accessed by the RTSP of the easycvr platform to easynvr?

Mlperf training v2.0 list released, with the same GPU configuration, the performance of Baidu PaddlePaddle ranks first in the world

Factors affecting the quality of slip rings in production

Basic embedded concepts

Realization of binary relation of discrete mathematics with C language and its properties
![C WinForm [help interface - send email] - practice five](/img/2a/c4e7abe054e6fdd45acc7d297a033d.jpg)
C WinForm [help interface - send email] - practice five
随机推荐
Sql Server的存储过程详解
Process communication mode between different hosts -- socket
Random function usage notes
Shape template matching based on Halcon learning [viii] PM_ multiple_ models. Hdev routine
Bootloader implementation of PIC MCU
Consul安装
Reasons for rapid wear of conductive slip rings
UEFI development learning 6 - creation of protocol
导电滑环磨损快的原因
How to excavate and research ideas from the paper
Development tools -- gcc compiler usage
Connection mode - bridge and net
UEFI development learning series
solver. Learning notes of prototxt file parameters
Screen record of the opening ceremony of the Beijing winter olympics 2
Hardware 1 -- relationship between gain and magnification
Global and Chinese market of digital shore durometer 2022-2028: Research Report on technology, participants, trends, market size and share
Altium designer learning (I)
[untitled] record the visual shock of the Winter Olympics and the introduction of the display screen
C WinForm [exit application] - practice 3