本文整理汇总了C++中HttpServer::stop方法的典型用法代码示例。如果您正苦于以下问题:C++ HttpServer::stop方法的具体用法?C++ HttpServer::stop怎么用?C++ HttpServer::stop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HttpServer
的用法示例。
在下文中一共展示了HttpServer::stop方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetTickCount
void CP2PServiceModule::OnCheckTimer( UINT uID, UINT uTime )
{
if ( !g_socketClientMgr.IsConnected())
{
CKLog::WriteLog( LOG_TYPE_DEBUG, "reconnect server.%d", GetTickCount());
g_server.stop();
g_socketClientMgr.Release();
if ( g_socketClientMgr.Connect())
g_server.start();
}
}
示例2: CtrlHandler
BOOL CtrlHandler(DWORD fdwCtrlType)
{
HttpServer* server;
switch (fdwCtrlType)
{
// Handle the CTRL-C signal.
case CTRL_C_EVENT:
LOG(INFO) << "The user wants to close server.";
// shutdown server
server = (HttpServer*)MainObjectFactoryImpl::getInstance()->getObject("HttpServer");
if (server != NULL){
server->stop();
}
else{
LOG(WARNING) << "Failed to get server instance from factory.";
}
return(TRUE);
// CTRL-CLOSE: confirm that the user wants to exit.
//case CTRL_CLOSE_EVENT:
// // shutdown server
// if (server != NULL){
// server->stop();
// }
// return(TRUE);
// // Pass other signals to the next handler.
//case CTRL_BREAK_EVENT:
// Beep(900, 200);
// printf("Ctrl-Break event\n\n");
// return FALSE;
//case CTRL_LOGOFF_EVENT:
// Beep(1000, 200);
// printf("Ctrl-Logoff event\n\n");
// return FALSE;
//case CTRL_SHUTDOWN_EVENT:
// Beep(750, 500);
// printf("Ctrl-Shutdown event\n\n");
// return FALSE;
default:
return FALSE;
}
}
示例3: defined
void CP2PServiceModule::RunMessageLoop()
{
#if defined(_DEBUG)
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
CKLog::SetDebugType( LOG_TYPE_DEBUG);
#else
CKLog::SetDebugType( LOG_TYPE_WARNING);
#endif
char szServiceName[256];
::LoadString( NULL, IDS_SERVICENAME, szServiceName, sizeof(szServiceName));
ChangeServiceStartType( szServiceName, SERVICE_AUTO_START);
TCHAR szClient_Mutex[] = _T("PPVOD_MUTEX_K_1.0");
if ( ::OpenMutex(MUTEX_ALL_ACCESS, FALSE, szClient_Mutex) ) return;
::CreateMutex(0, FALSE, szClient_Mutex);
g_socketClientMgr.Connect();
bool bListen = false;
UINT uPort = 81;
for ( int i = 1; i < 20; i ++ )
{
g_server.setPort( uPort);
if ( g_server.create( string("P2PLocalService"), string("C:\\") ) )
{
bListen = true;
break;
}
uPort += i;
}
HttpResponse::setServer( g_server );
if ( bListen )
{
// 设置共享内存监听端口为 uPort
CRegKey reg;
LPCTSTR lpszKey = "SOFTWARE\\P2PService_K";
if ( reg.Open( HKEY_LOCAL_MACHINE, lpszKey ) == ERROR_SUCCESS )
{
TCHAR szAppPath[MAX_PATH];
ULONG ulLen = sizeof( szAppPath );
if ( reg.SetDWORDValue( "ListenPort", uPort ) == ERROR_SUCCESS )
{
}
reg.Close();
}
SetTimer( NULL, CHECK_SERVER_TIMER, 1000, NULL);
MSG msg;
while( GetMessage(&msg, NULL, 0, 0 ))
{
switch( msg.message) {
case WM_TIMER:
OnCheckTimer( 0, 0);
break;
default:
break;
}
TranslateMessage(&msg);
DispatchMessage(&msg);
}
KillTimer( NULL, CHECK_SERVER_TIMER);
}
g_server.stop();
SetServiceStatus(SERVICE_STOPPED);
}