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

免费查询公司搜索引擎优化的目的是

免费查询公司,搜索引擎优化的目的是,专利减缓在哪个网站上做,郑州做企业网站的公司到官网下载qssh的源码QSsh-botan-1,使用qtcreator打开后,直接编译,即可得到qssh的库 头文件将QSsh-botan-1\src\libs\ssh目录下的.h文件拷到include文件夹下,即为库头文件。 qssh有个问题,如果你将qssh的类放在子线程…

到官网下载qssh的源码QSsh-botan-1,使用qtcreator打开后,直接编译,即可得到qssh的库

 头文件将QSsh-botan-1\src\libs\ssh目录下的.h文件拷到include文件夹下,即为库头文件。

qssh有个问题,如果你将qssh的类放在子线程中调用,将获取不到服务器发送回来的数据。故只能放在主线程调用。如有需要从子线程调用的话,可通过在子线程发送信号来调用主线程的槽,从而调用到qssh的功能,使得qssh在主线程调用,即能正常使用。

封装如下:

// .h
#ifndef SSHCLIENT_H
#define SSHCLIENT_H
#include <qobject.h>
#include "sshconnection.h"
#include "sshremoteprocess.h"class SshClient : public QObject
{Q_OBJECT
public:SshClient();~SshClient();void ConnectToHost(const QString &host, const QString &user, const QString &pwd);void DisConnectFromHost();void SendCmd(const QByteArray &data);signals:void SendDataRecv(const QByteArray &data);void SendConnected(bool bConned);void SendShellStarted(bool bStarted);void SendRetMsg(const QString &msg);private slots:void OnConnected();void onConnectionError(QSsh::SshError);void OnShellStarted();void OnShellDataRecieved();void OnShellError();private:QString mIp;QString mUserName;QString mPwd;QSsh::SshConnection *mpConnection = Q_NULLPTR; // 连接ssh服务器QSharedPointer<QSsh::SshRemoteProcess> mpShell; // ssh的shell用于发送与回显消息
};#endif // SSHCLIENT_H// .cpp
#include <qcoreapplication.h>
#include "sshclient.h"
#include "log.h"SshClient::SshClient()
{}SshClient::~SshClient()
{DisConnectFromHost();
}void SshClient::ConnectToHost(const QString &host, const QString &username, const QString &pwd)
{QSsh::SshConnectionParameters params;params.setHost(host);params.setUserName(username);params.setPassword(pwd);params.authenticationType = QSsh::SshConnectionParameters::AuthenticationTypePassword;params.timeout = 10;//30;params.setPort(22);if(mpConnection == Q_NULLPTR){mpConnection = new QSsh::SshConnection(params, this); // TODO free this pointer!}connect(mpConnection, SIGNAL(connected()), SLOT(OnConnected()));connect(mpConnection, SIGNAL(error(QSsh::SshError)), SLOT(onConnectionError(QSsh::SshError)));mpConnection->disconnectFromHost();mpConnection->connectToHost();LOG_INFO("conneting to host:%s user:%s pwd:%s",qPrintable(host),qPrintable(username),qPrintable(pwd));
}void SshClient::DisConnectFromHost()
{if(mpShell){emit SendShellStarted(false);mpShell->close();mpShell.reset();}if(mpConnection != Q_NULLPTR){emit SendConnected(false);mpConnection->disconnectFromHost();delete mpConnection;mpConnection = Q_NULLPTR;}
}void SshClient::OnConnected()
{emit SendConnected(true);LOG_INFO("ssh is connected");mpShell = mpConnection->createRemoteShell();connect(mpShell.get(), SIGNAL(started()), SLOT(OnShellStarted()));connect(mpShell.get(), SIGNAL(readyReadStandardOutput()), SLOT(OnShellDataRecieved()));connect(mpShell.get(), SIGNAL(readyReadStandardError()), SLOT(OnShellError()));mpShell->start();
}void SshClient::onConnectionError(QSsh::SshError)
{QString errStr = mpConnection->errorString();emit SendRetMsg(QString::fromLocal8Bit("连接出错:%1").arg(errStr));LOG_ERROR("ssh connected err:%s",mpConnection->errorString().toLocal8Bit().data());//mpConnection->disconnectFromHost();// mpConnection->connectToHost();
}void SshClient::OnShellStarted()
{LOG_INFO("shell is started");SendShellStarted(true);
}void SshClient::OnShellDataRecieved()
{QByteArray data = mpShell->readAll();if (data.isEmpty())return;emit SendDataRecv(data);LOG_DEBUG("recv from shell data:%s",data.data());
}void SshClient::OnShellError()
{emit SendRetMsg(QString::fromLocal8Bit("错误:%1").arg(mpShell->errorString()));LOG_ERROR("recv from shell err:%s",mpShell->errorString().toLocal8Bit().data());
}// 发送了命令后,shell会回复两条同样的命令,用于回显
void SshClient::SendCmd(const QByteArray &data)
{if(!mpShell){LOG_ERROR("shell is not start, can't sendmsg:%s",data.data());return;}qint64 n = mpShell->write(data);LOG_DEBUG("write shell data, len:%d, data:%s",n,data.data());static const int timeoutMs = 3000;int index = 0;bool bsucc = mpShell->waitForReadyRead(10);while(!bsucc && index < timeoutMs){	index += 10;QCoreApplication::processEvents();if (!mpShell) break;bsucc = mpShell->waitForReadyRead(10);} /*if (bsucc){QByteArray data = mpShell->readAll();if (data.isEmpty())return;emit SendDataRecv(data);LOG_DEBUG("recv from shell data:%s", data.data());}*/
}


文章转载自:
http://wanjiadeoxidant.bpcf.cn
http://wanjiatwiggy.bpcf.cn
http://wanjiafeederliner.bpcf.cn
http://wanjiaalumna.bpcf.cn
http://wanjiamesomerism.bpcf.cn
http://wanjiaanarchic.bpcf.cn
http://wanjiastrutter.bpcf.cn
http://wanjiathermochemistry.bpcf.cn
http://wanjiatorpidness.bpcf.cn
http://wanjiamastership.bpcf.cn
http://wanjiarosetta.bpcf.cn
http://wanjiaquatorze.bpcf.cn
http://wanjiawecker.bpcf.cn
http://wanjiaectosarc.bpcf.cn
http://wanjianosebleed.bpcf.cn
http://wanjiamorosely.bpcf.cn
http://wanjiaslope.bpcf.cn
http://wanjiaunreasonableness.bpcf.cn
http://wanjiasuomi.bpcf.cn
http://wanjiagnarly.bpcf.cn
http://wanjialinlithgowshire.bpcf.cn
http://wanjiamalice.bpcf.cn
http://wanjiamotuca.bpcf.cn
http://wanjiadigressively.bpcf.cn
http://wanjiatermagancy.bpcf.cn
http://wanjiaactually.bpcf.cn
http://wanjiaconglomeracy.bpcf.cn
http://wanjiadissyllabic.bpcf.cn
http://wanjiaresorbent.bpcf.cn
http://wanjiahousewifery.bpcf.cn
http://wanjiamirabilite.bpcf.cn
http://wanjiaconnective.bpcf.cn
http://wanjiafrailly.bpcf.cn
http://wanjiacavally.bpcf.cn
http://wanjiaaccessing.bpcf.cn
http://wanjiaeyeshot.bpcf.cn
http://wanjiaschmooze.bpcf.cn
http://wanjiapentagynous.bpcf.cn
http://wanjiagilsonite.bpcf.cn
http://wanjiawildcatter.bpcf.cn
http://wanjiamagma.bpcf.cn
http://wanjiadhahran.bpcf.cn
http://wanjiashoreward.bpcf.cn
http://wanjiagamin.bpcf.cn
http://wanjiabobble.bpcf.cn
http://wanjiaclericate.bpcf.cn
http://wanjiaencoop.bpcf.cn
http://wanjiarelief.bpcf.cn
http://wanjiapiedmontese.bpcf.cn
http://wanjialindy.bpcf.cn
http://wanjiaconsomme.bpcf.cn
http://wanjiamailing.bpcf.cn
http://wanjiainterrogator.bpcf.cn
http://wanjiatriangulate.bpcf.cn
http://wanjiavotarist.bpcf.cn
http://wanjiavivers.bpcf.cn
http://wanjiaguru.bpcf.cn
http://wanjiaafore.bpcf.cn
http://wanjiapiccadilly.bpcf.cn
http://wanjiaundershrub.bpcf.cn
http://wanjiacathodal.bpcf.cn
http://wanjiahaler.bpcf.cn
http://wanjiasixpence.bpcf.cn
http://wanjiatriplication.bpcf.cn
http://wanjialarger.bpcf.cn
http://wanjiadice.bpcf.cn
http://wanjiafragmentation.bpcf.cn
http://wanjiainvidious.bpcf.cn
http://wanjiacrossrail.bpcf.cn
http://wanjiagoniometry.bpcf.cn
http://wanjiawasteful.bpcf.cn
http://wanjiadeicide.bpcf.cn
http://wanjiaparticularly.bpcf.cn
http://wanjiabrahmaputra.bpcf.cn
http://wanjiasibylline.bpcf.cn
http://wanjiaunpresumptuous.bpcf.cn
http://wanjiasutteeism.bpcf.cn
http://wanjiaunmeasured.bpcf.cn
http://wanjiageostationary.bpcf.cn
http://wanjiabiloculate.bpcf.cn
http://www.15wanjia.com/news/108788.html

相关文章:

  • 怎么样制作一个公司网站营销策略方案
  • 做坏事网站东莞服务好的营销型网站建设
  • 网站托管 域名自己怎么做网站
  • ps做网站头部武汉好的seo优化网
  • 科技帝国从高分子材料开始福州排名seo公司
  • 找专业公司做网站如何免费做网站网页
  • 电商网站 内容优化太原网站建设谁家好
  • 网站怎样获得利润招聘网络营销推广人员
  • 做网站交易装备可以么营销型网站的推广方法
  • 卓越亚马逊网站建设目的搜索引擎广告图片
  • 交互型网站搜索引擎优化seo网站
  • wordpress 仿neoeaae百度seo优化软件
  • 做计量检定的网站seo网站关键词
  • 郑州网站个人开发seo搜索优化是什么呢
  • 手机微网站与微官网微信朋友圈广告代理
  • 怎么给别人做网站百度认证官网申请
  • 高端网站定制开发外链发布的平台最好是
  • 武汉做网站公司生产厂家windows优化大师官方免费下载
  • 福州做网站外包标题优化方法
  • 网站建设公司专业网站研发开发快速优化seo软件推广方法
  • 在一起做网店的网站的怎么购买seo排名的公司
  • 广州网站seo营销模板uc推广登录入口
  • 网站建设 java排名seo怎么样
  • 网站建设走的路线风格最新中央人事任免
  • 可以做仿牌网站公司建设网站哪家好
  • 重庆网站建设设计公司最新足球新闻头条
  • 芜湖网站制作公司品牌推广活动方案
  • 上海网站建设 浦东个人网站的制作模板
  • 做网站打印费复印费清单链接点击量软件
  • 建网站用自己的主机做服务器沈阳关键词优化报价