启动与关闭WebService
【1】代码
1 /*
2 * @brief: 启动WebServcie服务器
3 * @return:void
4 */
5 void UPCSoftphoneClient::startWebService()
6 {
7 m_pWSProcess = new QProcess;
8 QString strSeparator = QString(QDir::separator()) + QString(QDir::separator());
9 QString strExePath = qApp->applicationDirPath().replace(QChar('/'), strSeparator) + strSeparator + QString(WEB_SERVICE_NAME);
10 m_pWSProcess->start(strExePath, QStringList("4567"));
11 }
12
13 /*
14 * @brief: 关闭WebService服务器
15 * @return:void
16 */
17 void UPCSoftphoneClient::closeWebService()
18 {
19 if (m_pWSProcess != Q_NULLPTR)
20 {
21 m_pWSProcess->waitForFinished(1000);
22 m_pWSProcess->start(QString("taskkill /f /im ").append(QString(WEB_SERVICE_NAME)));
23
24 delete m_pWSProcess;
25 m_pWSProcess = Q_NULLPTR;
26 }
27 }
Good Good Study, Day Day Up.
顺序 选择 循环 总结