当前位置: 首页 > news >正文

太原网站建设加q.479185700攻击wordpress

太原网站建设加q.479185700,攻击wordpress,网站腾讯qq对话框怎么做,企业建站系统开源QT项目_RPC(进程间通讯) 前言#xff1a; 两个进程间通信、或是说两个应用程序之间通讯。实际情况是在QT开发的一个项目中#xff0c;里面包含两个子程序#xff0c;子程序有单独的界面和应用逻辑#xff0c;这两个子程序跑起来之后需要一些数据的交互#xff0c;例如 两个进程间通信、或是说两个应用程序之间通讯。实际情况是在QT开发的一个项目中里面包含两个子程序子程序有单独的界面和应用逻辑这两个子程序跑起来之后需要一些数据的交互例如一个程序是用户界面和用户程序另一个程序时OSD菜单 注意RPC通讯传输的数据类型有bool、int和std::string(QString不行) 效果演示 1、移植RCP源码到自己工程 ①移植RPC说白了就是两个文件夹里面有N多个源文件直接复制过来直接用需要自行修改.pro文件以便加入编译 # rest_rpc INCLUDEPATH $$PWD/msgpack DEPENDPATH $$PWD/msgpack②工程目录 2、源码展示 test_rpc.pro TEMPLATE subdirsSUBDIRS \apply \layer apply/apply.pro QT quick \widgetsCONFIG c11# The following define makes your compiler emit warnings if you use # any Qt feature that has been marked deprecated (the exact warnings # depend on your compiler). Refer to the documentation for the # deprecated API to know how to port your code away from it. DEFINES QT_DEPRECATED_WARNINGS# You can also make your code fail to compile if it uses 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_BEFORE0x060000 # disables all the APIs deprecated before Qt 6.0.0SOURCES \main.cpp \mainwidget.cpp \rpc/MessageTip.cpp \rpc/RPCClient.cpp \rpc/RPCServer.cppRESOURCES qml.qrc# Additional import path used to resolve QML modules in Qt Creators code model QML_IMPORT_PATH # Additional import path used to resolve QML modules just for Qt Quick Designer QML_DESIGNER_IMPORT_PATH # Default rules for deployment. qnx: target.path /tmp/$${TARGET}/bin else: unix:!android: target.path /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS target# rest_rpc INCLUDEPATH $$PWD/msgpack DEPENDPATH $$PWD/msgpackHEADERS \mainwidget.h \rpc/MessageTip.h \rpc/RPCClient.h \rpc/RPCServer.h apply/Headers/rpc/MessageTip.h #ifndef MESSAGETIP_H #define MESSAGETIP_H#include qstring.hnamespace MessageTip {void onApplyvalueChanged(int value);void onApplystringChanged(std::string value); }#endif // MESSAGETIP_H apply/Headers/rpc/RPCClient.h #ifndef RPCCLIENT_H #define RPCCLIENT_H#include rest_rpc/rpc_client.hppclass RPCClient { public:RPCClient();static RPCClient *get_instance(){static RPCClient manage;return manage;}/*** brief 尝试连接RPC Server* return true 连接成功false 连接失败*/void tryConnect();rest_rpc::rpc_client *getSocketObject();private:rest_rpc::rpc_client *m_pClient nullptr; };#endif // RPCCLIENT_H apply/Headers/rpc/RPCServer.h #ifndef RPCSERVER_H #define RPCSERVER_H#include qstring.h #include rest_rpc/rpc_server.husing namespace rest_rpc; using namespace rpc_service;class RPCServer { public:RPCServer();void setApplyvalue(rpc_conn conn , int value);void setApplystring(rpc_conn conn , std::string value); };#endif // RPCSERVER_H apply/Headers/mainwidget.h #ifndef MAINWIDGET_H #define MAINWIDGET_H#include QObject #include QWidget #include QQmlComponent #include QQmlApplicationEngine #include QQuickItem #include rpc/RPCServer.hclass MainWidget : public QObject {Q_OBJECT public:MainWidget();protected slots:void onClickPageNo(bool enable);void onApplyvalueChanged(int value);void onApplystringChanged(QString value);private:QQuickItem *m_applyItem nullptr;QObject *m_applyObject nullptr;RPCServer *m_pRPCServer nullptr; };#endif // MAINWIDGET_H apply/Sources/rpc/MessageTip.cpp #include MessageTip.h #include RPCClient.h #include qdebug.hvoid MessageTip::onApplyvalueChanged(int value) {try {RPCClient::get_instance()-getSocketObject()-callvoid(MessageTip::layervalueChanged, value);} catch (const std::exception e) {qDebug() Exception {}, e.what();} }void MessageTip::onApplystringChanged(std::string value) {try {RPCClient::get_instance()-getSocketObject()-callvoid(MessageTip::layerstringChanged, value);} catch (const std::exception e) {qDebug() Exception {}, e.what();} } apply/Sources/rpc/RPCClient.cpp #include RPCClient.h #include QtDebugRPCClient::RPCClient() {}void RPCClient::tryConnect() {m_pClient new rest_rpc::rpc_client(127.0.0.1, 9000);m_pClient-enable_auto_reconnect(true);m_pClient-connect();std::thread([] {while (true){if (m_pClient-has_connected()) {qDebug() apply RPC connect success;break;} else {qDebug() apply RPC connect fail;std::this_thread::sleep_for(std::chrono::milliseconds(500));}}}).detach(); }rest_rpc::rpc_client *RPCClient::getSocketObject() {return m_pClient; } apply/Sources/rpc/RPCServer.cpp #include RPCServer.h #include qdebug.hRPCServer::RPCServer() {std::thread([] {rpc_server server(9001, std::thread::hardware_concurrency());server.register_handler(MessageTip::setApplyvalue, RPCServer::setApplyvalue, this);server.register_handler(MessageTip::setApplystring, RPCServer::setApplystring, this);server.run();}).detach(); }void RPCServer::setApplyvalue(rpc_conn conn , int value) {//todoqDebug() apply recv : value; }void RPCServer::setApplystring(rpc_conn conn , std::string value) {//todoqDebug() apply recv : QString::fromStdString(value); } apply/Sources/main.cpp #include QGuiApplication #include QQmlApplicationEngine #include mainwidget.h #include qdebug.h #include qthread.hint main(int argc, char *argv[]) {QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);QGuiApplication app(argc, argv);// QQmlApplicationEngine engine; // const QUrl url(QStringLiteral(qrc:/main.qml)); // QObject::connect(engine, QQmlApplicationEngine::objectCreated, // app, [url](QObject * obj, const QUrl objUrl) { // if (!obj url objUrl) { // QCoreApplication::exit(-1); // } // }, Qt::QueuedConnection); // engine.load(url);MainWidget mainwidget;return app.exec(); } apply/Sources/mainwidget.cpp #include mainwidget.h #include qdebug.h #include rpc/RPCClient.h #include rpc/MessageTip.h #include QProcessMainWidget::MainWidget() {QQmlApplicationEngine *m_pEngine new QQmlApplicationEngine;QQmlComponent component(m_pEngine, QUrl(QStringLiteral(qrc:/main.qml)));QObject *mainObject component.create();if (mainObject nullptr) {qDebug() mainObject fail;return;}QListQObject * objectList mainObject-findChildrenQObject *(mybutton);if (objectList.isEmpty()) {qDebug() mybutton failed\n;return;}m_applyObject objectList.last();connect(m_applyObject, SIGNAL(applyvalueChanged(int)), this, SLOT(onApplyvalueChanged(int)));connect(m_applyObject, SIGNAL(applystringChanged(QString)), this, SLOT(onApplystringChanged(QString)));connect(mainObject, SIGNAL(window_interface(bool)), this, SLOT(onClickPageNo(bool)));m_pRPCServer new RPCServer();RPCClient::get_instance()-tryConnect(); }void MainWidget::onClickPageNo(bool enable) {QProcess *process new QProcess();process-start(/home/zhou/work/test/build-test_rpc-Desktop_Qt_5_14_2_GCC_64bit-Debug/layer/layer); }void MainWidget::onApplyvalueChanged(int value) {qDebug() onApplyvalueChanged value;MessageTip::onApplyvalueChanged(value); }void MainWidget::onApplystringChanged(QString value) {qDebug() onApplystringChanged value;MessageTip::onApplystringChanged(std::string(value.toLocal8Bit())); } apply/main.qml import QtQuick 2.12 import QtQuick.Window 2.12 import QtQuick.Controls 2.12Window {visible: truewidth: 640height: 480objectName: apply_windowtitle: qsTr(Hello apply)signal window_interface(bool enable)Column{anchors.fill: parentspacing: 20Button{width: 140height: 50text: 开启界面2onClicked: {window_interface(true)}}Mybutton{width: 140height: 300}} } apply/Mybutton.qml import QtQuick 2.0 import QtQuick.Controls 2.12Item {objectName: mybuttonsignal applyvalueChanged(int value)signal applystringChanged(string value)Column{spacing: 10Button{objectName: buttonwidth: 140height: 50text: send1onClicked: {applyvalueChanged(1)}}Button{width: 140height: 50text: send2onClicked: {applyvalueChanged(2)}}Button{width: 140height: 50text: 验证stringonClicked: {applystringChanged({\name\:\lili\,\age\:24,\class\:6})}}} } layer.pro QT quick QT widgetsCONFIG c11# The following define makes your compiler emit warnings if you use # any Qt feature that has been marked deprecated (the exact warnings # depend on your compiler). Refer to the documentation for the # deprecated API to know how to port your code away from it. DEFINES QT_DEPRECATED_WARNINGS# You can also make your code fail to compile if it uses 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_BEFORE0x060000 # disables all the APIs deprecated before Qt 6.0.0SOURCES \main.cpp \mainwidget.cpp \rpc/MessageTip.cpp \rpc/RPCClient.cpp \rpc/RPCServer.cppRESOURCES qml.qrc# Additional import path used to resolve QML modules in Qt Creators code model QML_IMPORT_PATH # Additional import path used to resolve QML modules just for Qt Quick Designer QML_DESIGNER_IMPORT_PATH # Default rules for deployment. qnx: target.path /tmp/$${TARGET}/bin else: unix:!android: target.path /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS target# rest_rpc INCLUDEPATH $$PWD/msgpack DEPENDPATH $$PWD/msgpackHEADERS \mainwidget.h \rpc/MessageTip.h \rpc/RPCClient.h \rpc/RPCServer.h layer/Headers/rpc/MessageTip.h #ifndef MESSAGETIP_H #define MESSAGETIP_H#include qstring.hnamespace MessageTip {void setApplyvalue(int value);void setApplystring(std::string value); }#endif // MESSAGETIP_H layer/Headers/rpc/RPCClient.h #ifndef RPCCLIENT_H #define RPCCLIENT_H#include rest_rpc/rpc_client.hppclass RPCClient { public:RPCClient();static RPCClient *get_instance(){static RPCClient layer_manage;return layer_manage;}/*** brief 尝试连接RPC Server* return true 连接成功false 连接失败*/void tryConnect();rest_rpc::rpc_client *getSocketObject();private:rest_rpc::rpc_client *m_pClient nullptr; };#endif // RPCCLIENT_H layer/Headers/rpc/RPCServer.h #ifndef RPCSERVER_H #define RPCSERVER_H#include QtDebug #include QThread #include QObject #include QQuickItem#include rest_rpc/rpc_server.h using namespace rest_rpc; using namespace rpc_service;class RPCServer : public QObject {Q_OBJECT public:explicit RPCServer(QObject *parent nullptr);void layervalueChanged(rpc_conn conn , int value);void layerstringChanged(rpc_conn conn , std::string value);protected:signals:private:QObject *m_pMainObject nullptr;QQuickItem *m_pOSDAreaItem nullptr; };#endif // RPCSERVER_H layer/Headers/mainwidget.h #ifndef MAINWIDGET_H #define MAINWIDGET_H#include QObject #include QQmlComponent #include QQmlApplicationEngine #include QQuickItem #include rpc/RPCServer.hclass mainwidget : public QObject {Q_OBJECT public:mainwidget();private:RPCServer *m_pRPCServer nullptr; };#endif // MAINWIDGET_H layer/Sources/rpc/MessageTip.cpp #include MessageTip.h #include RPCClient.h #include QtDebugvoid MessageTip::setApplyvalue(int value) {try {return RPCClient::get_instance()-getSocketObject()-callvoid(MessageTip::setApplyvalue, value);} catch (const std::exception e) {qDebug() setImageRotate exception e.what();} }void MessageTip::setApplystring(std::string value) {try {return RPCClient::get_instance()-getSocketObject()-callvoid(MessageTip::setApplystring, value);} catch (const std::exception e) {qDebug() setImageRotate exception e.what();} } layer/Sources/rpc/RPCClient.cpp #include RPCClient.h #include QtDebugRPCClient::RPCClient() {}void RPCClient::tryConnect() { //#if defined(__x86_64) // m_pClient new rest_rpc::rpc_client(192.168.31.95, 9001); //#elsem_pClient new rest_rpc::rpc_client(127.0.0.1, 9001); //#endifm_pClient-enable_auto_heartbeat(true);m_pClient-connect();std::thread([] {while (true){qDebug() layer RPC connect fail;if (m_pClient-has_connected()) {qDebug() layer RPC connect success;break;} else {std::this_thread::sleep_for(std::chrono::milliseconds(500));qDebug() layer RPC connect fail;}}}).detach(); }rest_rpc::rpc_client *RPCClient::getSocketObject() {return m_pClient; } layer/Sources/rpc/RPCServer.cpp #include RPCServer.h #include rpc/MessageTip.hRPCServer::RPCServer(QObject *parent) : QObject(parent) {QThread::create([] {rpc_server server(9000, std::thread::hardware_concurrency());server.register_handler(MessageTip::layervalueChanged, RPCServer::layervalueChanged, this);server.register_handler(MessageTip::layerstringChanged, RPCServer::layerstringChanged, this);server.run();})-start();qDebug() start rpc server; }void RPCServer::layervalueChanged(rpc_conn conn , int value) {//todoMessageTip::setApplyvalue(value);qDebug() APPLY SEND : value; }void RPCServer::layerstringChanged(rpc_conn conn , std::string value) {//todoMessageTip::setApplystring(value);qDebug() APPLY SEND : QString::fromStdString(value); } layer/Sources/main.cpp #include QGuiApplication #include QQmlApplicationEngine #include qdebug.h #include mainwidget.hint main(int argc, char *argv[]) {QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);QGuiApplication app(argc, argv);// QQmlApplicationEngine engine; // const QUrl url(QStringLiteral(qrc:/main.qml)); // QObject::connect(engine, QQmlApplicationEngine::objectCreated, // app, [url](QObject * obj, const QUrl objUrl) { // if (!obj url objUrl) { // QCoreApplication::exit(-1); // } // }, Qt::QueuedConnection); // engine.load(url);mainwidget mainwidget;return app.exec(); } layer/Sources/mainwidget.cpp #include mainwidget.h #include rpc/RPCClient.hmainwidget::mainwidget() {QQmlApplicationEngine *m_pEngine new QQmlApplicationEngine;QQmlComponent component(m_pEngine, QUrl(QStringLiteral(qrc:/main.qml)));QObject *mainObject component.create();if (mainObject nullptr) {qDebug() mainObject fail;return;}m_pRPCServer new RPCServer();RPCClient::get_instance()-tryConnect(); } layer/main.qml import QtQuick 2.12 import QtQuick.Window 2.12 import QtQuick.Controls 2.12Window {visible: truewidth: 640height: 480title: qsTr(Hello layer)Column{anchors.fill: parentspacing: 20Button{width: 140height: 50text: layer }Button{width: 140height: 50text: layer -}} }
http://www.tj-hxxt.cn/news/132294.html

相关文章:

  • 阜城网站建设代理企业网站开发毕业报告
  • 网站优化是做什么的怀化seo
  • 怎么样模仿网站海口的网站建设公司
  • 重庆网站建设子沃科技熊掌号牟平网站建设
  • 织梦 xml网站地图自己网站开发
  • 国外手机网站设计成都旅游公司排名前十
  • 上海网站建设网络推广wordpress 描文本优化
  • 宁波网站推广宣传公司排名林西网站建设优化
  • 哪个网站是自己销售网站seo设置
  • 公司形象墙设计方案黄骅做网站|黄骅网站|黄骅百度优化|黄骅百度推广|黄骅微信|黄骅
  • 珲春市建设局网站是多少怎么做表格
  • 网站建设背景怎么设置成私人网官网
  • wordpress建站上海金昌百度seo
  • dede网站后台模板网站搭建与生成技术教材
  • 凡科快速建站wordpress 图片加水印
  • 长沙网站制作哪家强网站怎么做的精致一点
  • 做一个二手网站怎么做怎样建立自己网站视频网站
  • 高安建站公司互联网电商
  • 做婚姻介绍网站赚钱吗手机本地建WordPress
  • 免费做字体的网站好广州市医院网站建设
  • 济南公司注册网站设计师网络接单
  • 南昌网站建设公司网站建设公司app线上推广方式
  • 网上做网站网站潍坊 网站推广
  • 做印刷的有什么网站如何在百度网站收录提交入口
  • 学做网站视频论坛娱乐城网站开发
  • 赣州市铁路建设办公室网站网站备案麻烦么
  • 网站开发需求分析与功能设计网站备案密码格式
  • 网站做gzip压缩seo技术培训唐山
  • 网站建设买服务器还是数据库商务网站开发的基本原则
  • 做进出口外贸网站黄金行情软件下载