这篇教程C++ stopServer函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中stopServer函数的典型用法代码示例。如果您正苦于以下问题:C++ stopServer函数的具体用法?C++ stopServer怎么用?C++ stopServer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了stopServer函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: LOGvoid CServerApp::resetServer(const CEvent&, void*){ LOG((CLOG_DEBUG1 "resetting server")); stopServer(); cleanupServer(); startServer();}
开发者ID:axelson,项目名称:synergy-plus,代码行数:7,
示例2: streamvoid MainDaemon::answerRequest(){ //curSock->waitForReadyRead(1000); //wait max 1 second for the request from the client static bool working = false; if(working || curSock==0){ return; } working = true; QStringList req, out; bool stopdaemon=false; QTextStream stream(curSock); bool done = false; while(!stream.atEnd()){ req = QString(stream.readLine()).split(" "); //qDebug() << " - Request:" << req; //qDebug() << "Request Received:" << req; if(req.join("")=="shutdowndaemon"){ stopdaemon=true; done=true; break; } if(req.join("")=="[FINISHED]"){ done = true; break; } else{ QString res = SYSTEM->runRequest(req); //For info not available, try once more time as it can error unexpectedly if it was // stuck waiting for a sync to finish //if(res =="[ERROR] Information not available"){ res = DATA->fetchInfo(req); } out << "[INFOSTART]"+ res; } } //Now write the output to the socket and disconnect it //qDebug() << " - Request replied:" << done; stream << out.join("/n"); //curSock->disconnectFromServer(); working = false; if(done){ stream << "/n[FINISHED]"; } else{ QTimer::singleShot(0,this, SLOT(answerRequest()) ); } if(stopdaemon){ QTimer::singleShot(10, this, SLOT(stopServer())); }}
开发者ID:meths,项目名称:pcbsd,代码行数:33,
示例3: trvoid MainWindow::on_actionConfigure_triggered(){ if(serverState == ServerWorking) { int w = QMessageBox::warning(this, tr("Reconfigure Database?"), tr("Server is working now.../n" "you must stop server, if you want to reconfigure server./n" "Are you sure to stop server?"), tr("Yes, I sure"), tr("No, thanks")); if(w == 0) stopServer(); else return; } DatabaseConfigureDialog dbConfDialog; dbConfDialog.setSqlDatabase(&db); // init configure if(db) { dbConfDialog.setHostName(db->hostName()); dbConfDialog.setHostPort(db->port()); dbConfDialog.setUserName(db->userName()); dbConfDialog.setPassword(db->password()); dbConfDialog.setDatabaseName(db->databaseName()); } dbConfDialog.exec();}
开发者ID:ChepenSmilelife,项目名称:fse-server,代码行数:25,
示例4: startServervoid MainWindow::on_actionStartOrStop_triggered(){ if(serverState == ServerStop) startServer(); else stopServer();}
开发者ID:ChepenSmilelife,项目名称:fse-server,代码行数:7,
示例5: qDebug/*! Handles the changed /a state of the connection manager.*/void TicTacServer::handleConnectionManagerStateChanged(int state){ qDebug() << "TicTacServer::handleConnectionManagerStateChanged():" << state; switch (state) { case ConnectionManager::NotConnected: { stopServer(); break; } case ConnectionManager::Connecting: { break; } case ConnectionManager::Connected: { // Start server, in case of pending start call if (mState == Stopped || mState == Starting) { startServer(); } break; } case ConnectionManager::Disconnecting: { break; } case ConnectionManager::Failed: { mBroadcastTimer.stop(); setState(ConnectionError); break; } }}
开发者ID:Alex237,项目名称:tic-tac-toe-qt,代码行数:33,
示例6: mainint main( int argc, char ** argv ){ QCoreApplication a(argc, argv); //Check whether running as root if( getuid() != 0){ qDebug() << "pc-restserver must be started as root!"; return 1; } //Setup the log file if(DEBUG){ qDebug() << "pc-restserver Log File:" << logfile.fileName(); if(QFile::exists(logfile.fileName()+".old")){ QFile::remove(logfile.fileName()+".old"); } if(logfile.exists()){ QFile::rename(logfile.fileName(), logfile.fileName()+".old"); } //Make sure the parent directory exists if(!QFile::exists("/var/log")){ QDir dir; dir.mkpath("/var/log"); } logfile.open(QIODevice::WriteOnly | QIODevice::Append); qInstallMessageHandler(MessageOutput); } //Create and start the daemon qDebug() << "Starting the PC-BSD REST server interface...."; WebServer *w = new WebServer(); if( w->startServer() ){ //Now start the event loop QTimer::singleShot(1000, w, SLOT(stopServer()) ); //for testing purposes int ret = a.exec(); logfile.close(); return ret; }else{ return 1; }}
开发者ID:ownsherass,项目名称:pcbsd,代码行数:35,
示例7: mainint main(int argc, char * argv[]){ int cclients = 10; int sentMsg = 0; printf("Server iniciado para %d clientes./n", cclients); message_t incomingMsg; message_t msgsent; char * word = "Mensaje del Server"; ipc_t server = (ipc_t) fifoServe(cclients); server->stop = 0; while(sentMsg != 1000){ if((incomingMsg = qget(server->inbox)) != NULL){ printf("%d. Server recibio: %s/n", sentMsg, incomingMsg->data); printf("Manda mensaje a:%d./n", incomingMsg->header.from); qput(server->outbox, (msgsent = mnew(0,incomingMsg->header.from, strlen(word) + 1, word))); mdel(msgsent); mdel(incomingMsg); sentMsg++; } } stopServer(server);}
开发者ID:alejandromagnorsky,项目名称:so2010,代码行数:27,
示例8: QTcpServer//------------------------------------------------------------------------------My4Server::My4Server(QObject *parent) : QTcpServer(parent){ if (listen(QHostAddress::Any, 7700)) qDebug("qt4server"); QTimer::singleShot(5000, this, SLOT(stopServer()));}
开发者ID:MarianMMX,项目名称:MarianMMX,代码行数:8,
示例9: unlinkbool TestDebugger::RunTests(const std::string &which) { bool ret = true; unlink("/tmp/hphpd_test_error.log"); AsyncFunc<TestDebugger> func(this, &TestDebugger::runServer); func.start(); { // To make sure TestSanity always get run std::string which = "TestSanity"; RUN_TEST(TestSanity); } RUN_TEST(TestBasic); RUN_TEST(TestBreak); RUN_TEST(TestFlow); RUN_TEST(TestStack); RUN_TEST(TestEval); RUN_TEST(TestException); RUN_TEST(TestInfo); RUN_TEST(TestWebRequest); stopServer(); func.waitForEnd(); return ret;}
开发者ID:wez,项目名称:hiphop-php,代码行数:26,
示例10: mainvoid main(void){ int tmpFlag; tmpFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG ); tmpFlag |= _CRTDBG_CHECK_ALWAYS_DF; tmpFlag |= _CRTDBG_LEAK_CHECK_DF; _CrtSetDbgFlag( tmpFlag ); readConfigFile("C://Simulink_SimServer//io_config.cfg"); PortNumber = 80; startServer(); printf("/n"); printf("***** Press any key to quit *****/n"); printf("/n"); while(1) { if(kbhit()) { break; } } stopServer();#ifdef TEST_HARNESS_ASSERTE(_CrtCheckMemory());#endif}
开发者ID:jonmills,项目名称:simserver,代码行数:33,
示例11: SrvPlayFile/** * Play back specified file. * * @param file * file path. * @return * 0 if file playback started, 1 if output was locked, other values on errors. */intSrvPlayFile( const char * file ){ int status; stopServer(); LOCK_PLAYMUTEX(); strcpy(trackName, file); playtype = NPT_FILE; going = 1; everPlayed = 0; UNLOCK_PLAYMUTEX(); status = playFile(file); if (status) stopPlaying(); else { LOCK_PLAYMUTEX(); playState = NMS_STATUS_PLAYER_PLAY; errorStatus = NMS_STATUS_OK; UNLOCK_PLAYMUTEX(); } return status;}
开发者ID:gerboland,项目名称:osd-nms,代码行数:33,
示例12: SrvStop/** * Stop current playback. */voidSrvStop( void ){ int loc_going; int loc_fileIdx; int loc_everPlayed; int loc_playtype; LOCK_PLAYMUTEX(); loc_going = going; loc_fileIdx = fileIdx; loc_playtype = playtype; UNLOCK_PLAYMUTEX(); if (loc_going) // if playing, set history before shutdown. { char * path = NULL; char buf[PATH_MAX]; DBGMSG("Stop server playback."); switch (loc_playtype) { case NPT_FILE: LOCK_PLAYMUTEX(); path = strcpy(buf, trackName); UNLOCK_PLAYMUTEX(); break; case NPT_DIR: path = nextFileFromDir(loc_fileIdx,buf,PATH_MAX); break; default: //history not supported. WPRINT("play history not supported."); break; } LOCK_PLAYMUTEX(); loc_fileIdx = fileIdx; loc_everPlayed = everPlayed; UNLOCK_PLAYMUTEX(); if (path) { int mark; LOCK_PLAYMUTEX(); mark = playtime; UNLOCK_PLAYMUTEX(); if (loc_everPlayed) SetPlayHistory(loc_playtype, loc_fileIdx, mark, path); } } stopServer(); LOCK_PLAYMUTEX(); // player has been stop upon user request. errorStatus = NMS_STATUS_PLAYER_STOPPED; UNLOCK_PLAYMUTEX();}
开发者ID:gerboland,项目名称:osd-nms,代码行数:62,
示例13: delServervoid delServer(Server * srv){ //make sure to stop the server thread stopServer(srv); close(srv->socket); free(srv); return;}
开发者ID:ericase,项目名称:Gs503ToSql,代码行数:8,
示例14: Q3ServerSocket//------------------------------------------------------------------------------My3Server::My3Server(QObject *parent) : Q3ServerSocket(7700, 1, parent), m_socket(0){ if (ok()) qDebug("qt3server"); QTimer::singleShot(5000, this, SLOT(stopServer()));}
开发者ID:tsuibin,项目名称:emscripten-qt,代码行数:9,
示例15: stopServerDatabaseMysql::~DatabaseMysql(){ stopServer(); //Free Mysql library pointers for last ~DB if (--db_count == 0) mysql_library_end();}
开发者ID:IdbeHoldL,项目名称:DayZhiveEpoch,代码行数:8,
示例16: getSelectedServervoid CServerDoc::delSelectedServer(void){ ServerControl* sc = getSelectedServer(); stopServer(sc); m_Servers.RemoveAt(m_SelectedServer); delete sc; m_SelectedServer -= 1; writeFile(false);}
开发者ID:m-ober,项目名称:ServerChecker,代码行数:9,
示例17: sTennisServer::~TennisServer(){ if(stream){ QByteArray b; QDataStream s(&b, QIODevice::WriteOnly); s << QString("D"); clientSocket->write(b); } stopServer();}
开发者ID:KDE,项目名称:android-qt-mobility,代码行数:11,
示例18: evaluatebool evaluate(char* command) { if (strcmp(HELP, command) == 0) { printHelp(); } else if (strcmp(STOP, command) == 0) { stopServer(); return false; } else { WRN("Undefined command: %s", command); } return true;}
开发者ID:duplyakin,项目名称:CppCourse,代码行数:11,
示例19: stopServerbool ConcreteDatabase::initialise(Poco::Logger& dbLogger, const KeyValueColl& connParams, bool logSql, const string& logDir, size_t nConns){ stopServer(); _logger = &dbLogger; //Enable logging of SQL commands (usually only high-risk commands) //(See method: PExecuteLog) _shouldLogSQL = logSql; _sqlLogsDir = logDir; if(!_sqlLogsDir.empty()) { if((_sqlLogsDir.at(_sqlLogsDir.length()-1)!='/') && (_sqlLogsDir.at(_sqlLogsDir.length()-1)!='//')) _sqlLogsDir.append("/"); } //create DB connections //setup connection pool size size_t poolSize = nConns; if(poolSize < MIN_CONNECTION_POOL_SIZE) poolSize = MIN_CONNECTION_POOL_SIZE; else if(poolSize > MAX_CONNECTION_POOL_SIZE) poolSize = MAX_CONNECTION_POOL_SIZE; //initialize and connect all the connections _queryConns.clear(); _queryConns.reserve(poolSize); try { //create and initialize the sync connection pool for (size_t i=0; i<poolSize; i++) { unique_ptr<SqlConnection> pConn = createConnection(connParams); pConn->connect(); _queryConns.push_back(pConn.release()); } //create and initialize connection for async requests _asyncConn = createConnection(connParams); _asyncConn->connect(); } catch(const SqlConnection::SqlException& e) { e.toLog(dbLogger); return false; } _resultQueue.clear(); initDelayThread(); return true;}
开发者ID:AlexSpain,项目名称:hive,代码行数:54,
示例20: qDebugvoid CopySenderServer::requestHandler(QString data){ JSON *instance = &JSON::instance(); //go and parse the json to an object concurrently... QFuture <QVariantMap>future = QtConcurrent::run(instance, &JSON::parse, data); const QVariantMap jsonObject = future.result();//finally retrieve the jsonObject after it has been parsed QVariant handler = jsonObject.value("handler"); if(!handler.toString().compare("QVariant(, )")){ qDebug()<< "invalid JSON String::"<<data; } if(firstTalk){ if(!handler.toString().compare("HelloCopySender")){ //check whether the machine is the right machine that should connect to it... if(jsonObject.value("machineID").toString().compare(QString::number(machineId))){ socket->disconnectFromHost(); return; }else{ //if it is the right machine continue firstTalk = false; //stop the server since you don't want to allow any other connections stopServer(); } }else{ socket->disconnectFromHost(); return; } QString jsonMessage = startJSONMessage(); appendJSONValue(jsonMessage, "handler", "HelloCopyReceiver", false); endJSONMessage(jsonMessage); sendJSONMessage(socket, jsonMessage); return; } if(!handler.toString().compare("SendDifferences")) SendDifferences(); else if(!handler.toString().compare("BuildFileSumMD5")) BuildFileSumMD5(jsonObject); else if(!handler.toString().compare("NotifyCopySuccess")) NotifyCopySuccess(jsonObject);}
开发者ID:hhvvkk,项目名称:COS301DistrobutedApplicationManger,代码行数:53,
示例21: mainvoid main(void){ /* Configure the oscillator for the device */ ConfigureOscillator(); /* Initialize I/O and Peripherals for application */ InitApp(); W5200_nRESET = 0; __delay_us(5); W5200_nRESET = 1; __delay_ms(50); __delay_ms(50); __delay_ms(50); __delay_ms(50); /* Initialize application settings */ InitSettings(); /* Initialize TCP server */ initServer(&macAddress, &gateway, &netmask); startServer(&localEndpoint); LED = 1; while(1) { if(clientConnected()) { if(dataAvailable()) { uint16_t length = getReceivedLength(); if(length > MAX_BUFFER) { // Limit maximum buffer size to avoid ram saturation due to packet flooding, a normal communication is shorter anyway length = MAX_BUFFER; } uint8_t buffer[MAX_BUFFER]; getReceivedData(buffer, length); parseCommand(buffer[0], buffer, length); stopServer(); startServer(&localEndpoint); } checkClientDisconnection(); } }}
开发者ID:snow4life,项目名称:PicHomeAutomation,代码行数:53,
示例22: stopServervoid CServerDoc::stopAllServers(bool dontStop){ for (int i = 0; i <= m_Servers.GetUpperBound(); i++) { ServerControl* sc = m_Servers[i]; if (sc) { sc->dontStopServer(dontStop); stopServer(sc); } }}
开发者ID:m-ober,项目名称:ServerChecker,代码行数:12,
示例23: startServervoid NetworkManager::startServer() { if (state == NetworkStateServer) stopServer(); if (state == NetworkStateClient) stopClient(); LOG("Starting server..."); state = NetworkStateServer; server = new GameServer(GAME_PORT); if (server->start() < 0) { LOG("ERROR: SERVER FAILED TO START."); return; }}
开发者ID:EmbiaWu,项目名称:the-pintos-within,代码行数:14,
示例24: startClientvoid NetworkManager::startClient(const char* host) { if (state == NetworkStateServer) stopServer(); if (state == NetworkStateClient) stopClient(); LOG("Starting client..."); state = NetworkStateClient; client = new GameClient(host, GAME_PORT); if (client->connect() < 0) { LOG("ERROR: CLIENT FAILED TO CONNECT."); return; }}
开发者ID:EmbiaWu,项目名称:the-pintos-within,代码行数:14,
示例25: createTrayObjectvoid MainWidget::createTrayIcon(){ trayIcon = createTrayObject(this); trayIcon->init();#ifndef Q_OS_WIN32 trayIcon->setIcon("qcma_off");#else trayIcon->setIcon("tray/qcma_off_16");#endif trayIcon->show(); connect(trayIcon, SIGNAL(openConfig()), this, SLOT(openConfig())); connect(trayIcon, SIGNAL(openManager()), this, SLOT(openManager())); connect(trayIcon, SIGNAL(refreshDatabase()), this, SLOT(refreshDatabase())); connect(trayIcon, SIGNAL(showAboutDialog()), this, SLOT(showAboutDialog())); connect(trayIcon, SIGNAL(showAboutQt()), this, SLOT(showAboutQt())); connect(trayIcon, SIGNAL(stopServer()), this, SLOT(stopServer())); connect(managerForm, SIGNAL(deviceConnected(QString)), this, SLOT(deviceConnect(QString))); connect(managerForm, SIGNAL(deviceDisconnected()), this, SLOT(deviceDisconnect())); connect(managerForm, SIGNAL(messageSent(QString)), this, SLOT(receiveMessage(QString)));}
开发者ID:MarcoLeongDev,项目名称:qcma,代码行数:23,
示例26: deleteClientvoid Server::stopServer() { //untested code but 98% sure it'll do. CLIENT_DATA * clientData; isServerStopped = true; if(serverSocks.size() > 0) { for(unsigned int x = 0; x < serverSocks.size(); x++) { clientData = serverSocks[x]; deleteClient(clientData->index); } stopServer(); //recursive: we need to keep calling this until size() is zero. }}
开发者ID:petrock6,项目名称:Simple-Socks,代码行数:16,
示例27: stopServer/** * @brief SingleApplication::~SingleApplication * Destructor */SingleApplication::~SingleApplication(){ if(_shouldContinue) { emit stopServer(); if(!server->wait(5000)) { qDebug() << "TERMINATOR RETURNS BACK single application! 8-)"; server->terminate(); qDebug() << "Wait for nothing"; server->wait(); qDebug() << "Terminated!"; } } delete server;}
开发者ID:tcvicio,项目名称:PGE-Project,代码行数:20,
注:本文中的stopServer函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ stopSound函数代码示例 C++ stopRecording函数代码示例 |