当前位置:网站首页>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 .
边栏推荐
- UEFI development learning 2 - running ovmf in QEMU
- 万字详解八大排序 必读(代码+动图演示)
- [trio basic from introduction to mastery tutorial XIV] trio realizes unit axis multi-color code capture
- Can't find real-time chat software? Recommend to you what e-commerce enterprises are using!
- . Net service governance flow limiting middleware -fireflysoft RateLimit
- C WinForm [help interface - send email] - practice five
- Compilation warning solution sorting in Quartus II
- Define in and define out
- Gradle composite construction
- [popular science] some interesting things that I don't know whether they are useful or not
猜你喜欢

Matlab2018b problem solving when installing embedded coder support package for stmicroelectronic

Train your dataset with yolov4

C language enhancement -- pointer
![Shape template matching based on Halcon learning [VII] reuse_ model. Hdev routine](/img/55/0f05291755dc1c3c03db8e991a1ba1.jpg)
Shape template matching based on Halcon learning [VII] reuse_ model. Hdev routine

Introduction of air gap, etc

Altium designer 19.1.18 - change the transparency of copper laying

MLPerf Training v2.0 榜单发布,在同等GPU配置下百度飞桨性能世界第一

Hardware and software solution of FPGA key chattering elimination

Solutions to compilation warnings in Quartus II

Software designer: 03 database system
随机推荐
Reasons for rapid wear of conductive slip rings
Record the visual shock of the Winter Olympics and the introduction of the screen 2
Altium designer learning (I)
UEFI development learning 5 - simple use of protocol
Communication standard -- communication protocol
如何将EasyCVR平台RTSP接入的设备数据迁移到EasyNVR中?
Summary -st2.0 Hall angle estimation
My-basic application 2: my-basic installation and operation
C WinForm [view status bar -- statusstrip] - Practice 2
Step motor generates S-curve upper computer
Use of orbbec Astra depth camera of OBI Zhongguang in ROS melody
Global and Chinese market of core pallets 2022-2028: Research Report on technology, participants, trends, market size and share
[popular science] some interesting things that I don't know whether they are useful or not
Ads learning record (lna_atf54143)
1-stm32 operation environment construction
Global and Chinese market of peeled bourdon tubes 2022-2028: Research Report on technology, participants, trends, market size and share
H264 (I) i/p/b frame gop/idr/ and other parameters
Wifi-802.11 negotiation rate table
IEEE access personal contribution experience record
软件设计师:03-数据库系统