当前位置:网站首页>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 .
边栏推荐
- C WinForm [exit application] - practice 3
- Carrier period, electrical speed, carrier period variation
- Relationship between line voltage and phase voltage, line current and phase current
- Shell script basic syntax
- Some thoughts on extracting perspectives from ealfa and Ebeta
- [trio basic from introduction to mastery tutorial XIV] trio realizes unit axis multi-color code capture
- C WinForm [change the position of the form after running] - Practical Exercise 4
- 2021-10-28
- Drive LED -- GPIO control
- Live555 push RTSP audio and video stream summary (III) flower screen problem caused by pushing H264 real-time stream
猜你喜欢
[trio basic from introduction to mastery tutorial 20] trio calculates the arc center and radius through three points of spatial arc
The research found that the cross-border e-commerce customer service system has these five functions!
Makefile application
Can't find real-time chat software? Recommend to you what e-commerce enterprises are using!
Screen record of the opening ceremony of the Beijing winter olympics 2
A simple method to prove 1/t Fourier transform
Altium designer 19.1.18 - change the transparency of copper laying
如何将EasyCVR平台RTSP接入的设备数据迁移到EasyNVR中?
Class of color image processing based on Halcon learning_ ndim_ norm. hdev
Acwing - the collection of pet elves - (multidimensional 01 Backpack + positive and reverse order + two forms of DP for the answer)
随机推荐
solver. Learning notes of prototxt file parameters
Bluetooth hc-05 pairing process and precautions
Summary -st2.0 Hall angle estimation
Arduino uses nrf24l01+ communication
[untitled] record the visual shock of the Winter Olympics and the introduction of the display screen
Drive LED -- GPIO control
Detailed explanation of pragma usage
Ads usage skills
Programming knowledge -- assembly knowledge
C WinForm [display real-time time in the status bar] - practical exercise 1
UEFI development learning 5 - simple use of protocol
Global and Chinese market of core pallets 2022-2028: Research Report on technology, participants, trends, market size and share
Live555 RTSP audio and video streaming summary (II) modify RTSP server streaming URL address
Beijing Winter Olympics opening ceremony display equipment record 3
Embedded composition and route
How to define guid in AMI code
Wifi-802.11 negotiation rate table
H264 (I) i/p/b frame gop/idr/ and other parameters
C language # and #
The printer encountered an abnormal configuration problem 0x8007007e (win10)