当前位置: 首页>>代码示例>>C++>>正文


C++ SetAppState函数代码示例

本文整理汇总了C++中SetAppState函数的典型用法代码示例。如果您正苦于以下问题:C++ SetAppState函数的具体用法?C++ SetAppState怎么用?C++ SetAppState使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SetAppState函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetAppState

void CServerDlg::OnBnClickedStart()
{
	//m_Server.SetWorkerThreadCount(2);
	//m_Server.SetMaxShutdownWaitTime(100000000);
	//m_Server.SetMaxDatagramSize(50);
	//m_Server.SetDetectAttempts(0);

	//m_Server.SetDetectAttempts(0);
	//m_Server.SetDetectInterval(0);

	//m_Server.SetSendPolicy(SP_SAFE);

	m_Address.GetWindowText(m_strAddress);
	m_strAddress.Trim();

	SetAppState(ST_STARTING);

	if(m_Server.Start(ADDRESS, PORT))
	{
		::LogServerStart(ADDRESS, PORT);
		SetAppState(ST_STARTED);
	}
	else
	{
		::LogServerStartFail(m_Server.GetLastError(), m_Server.GetLastErrorDesc());
		SetAppState(ST_STOPPED);
	}
}
开发者ID:32719913,项目名称:HP-Socket,代码行数:28,代码来源:ServerDlg.cpp

示例2: SetAppState

void CClientDlg::OnBnClickedStop()
{
	SetAppState(ST_STOPPING);

	for(size_t i = 0; i < m_vtClients.Size(); i++)
	{
		CUdpClientPtr* pSocket = m_vtClients[i];

		if((*pSocket)->Stop())
			::LogClientStopping((DWORD)i + 1);
		//else
		//	ASSERT(FALSE);
	}

	::WaitWithMessageLoop(100L);

	CString strMsg;
	strMsg.Format(	_T(" *** Summary: expect -  %lld, send - %lld, recv - %lld"),
					m_llExpectReceived, m_llTotalSent, m_llTotalReceived);

	::LogMsg(strMsg);

	if(m_llExpectReceived == m_llTotalSent && m_llTotalSent == m_llTotalReceived)
		strMsg.Format(_T(" *** Success: time consuming -  %u millisecond !"), m_dwTimeconsuming);
	else
		strMsg.Format(_T(" *** Fail: manual terminated ? (or data lost)"));

	::LogMsg(strMsg);

	SetAppState(ST_STOPPED);
}
开发者ID:32719913,项目名称:HP-Socket,代码行数:31,代码来源:ClientDlg.cpp

示例3: SetAppState

void CServerDlg::OnBnClickedStart()
{
	SetAppState(ST_STARTING);

	if(::HP_Server_Start(m_HttpServer, ADDRESS, HTTP_PORT))
	{
		::LogServerStart(ADDRESS, HTTP_PORT, HTTP_NAME);

		if(::HP_Server_Start(m_HttpsServer, ADDRESS, HTTPS_PORT))
		{
			::LogServerStart(ADDRESS, HTTPS_PORT, HTTPS_NAME);
			SetAppState(ST_STARTED);
		}
		else
		{
			::HP_Server_Stop(m_HttpServer);

			::LogServerStartFail(::HP_Server_GetLastError(m_HttpsServer), ::HP_Server_GetLastErrorDesc(m_HttpsServer), HTTPS_NAME);
			SetAppState(ST_STOPPED);
		}
	}
	else
	{
		::LogServerStartFail(::HP_Server_GetLastError(m_HttpServer), ::HP_Server_GetLastErrorDesc(m_HttpServer), HTTP_NAME);
		SetAppState(ST_STOPPED);
	}
}
开发者ID:winghua,项目名称:HP-Socket,代码行数:27,代码来源:ServerDlg.cpp

示例4: SetAppState

void CClientDlg::OnBnClickedStart()
{
	SetAppState(ST_STARTING);

	CString strAddress;
	CString strPort;

	m_Address.GetWindowText(strAddress);
	m_Port.GetWindowText(strPort);

	USHORT usPort	= (USHORT)_ttoi(strPort);
	m_bAsyncConn	= m_Async.GetCheck();

	::LogClientStarting(strAddress, usPort);

	if(m_Client.Start(strAddress, usPort, m_bAsyncConn))
	{

	}
	else
	{
		::LogClientStartFail(m_Client.GetLastError(), m_Client.GetLastErrorDesc());
		SetAppState(ST_STOPED);
	}
}
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:25,代码来源:ClientDlg.cpp

示例5: SetAppState

void CClientDlg::OnBnClickedStart()
{
    SetAppState(ST_STARTING);

    CString strPort;

    m_Address.GetWindowText(m_strAddress);
    m_Port.GetWindowText(strPort);

    m_usPort	= (USHORT)_ttoi(strPort);
    m_dwConnID	= 0;

    m_pkgInfo.Reset();

    ::LogClientStarting(m_strAddress, m_usPort);

    if(m_Agent->Start(LOCAL_ADDRESS, TRUE))
    {
        SetAppState(ST_STARTED);
    }
    else
    {
        ::LogClientStartFail(m_Agent->GetLastError(), m_Agent->GetLastErrorDesc());
        SetAppState(ST_STOPED);
    }
}
开发者ID:407390911,项目名称:HP-Socket,代码行数:26,代码来源:ClientDlg.cpp

示例6: switch

void CVMPIServiceConnMgr::HandlePacket( const char *pData, int len )
{
	switch( pData[0] )
	{
		case VMPI_KILL_PROCESS:
		{
			HandlePacket_KILL_PROCESS( NULL );
		}
		break;
		
		case VMPI_SERVICE_DISABLE:
		{
			KillRunningProcess( "Got a VMPI_SERVICE_DISABLE packet", true );
			SetAppState( VMPI_SERVICE_STATE_DISABLED );
			SaveStateToRegistry();
		}
		break;

		case VMPI_SERVICE_ENABLE:
		{
			if ( g_iCurState == VMPI_SERVICE_STATE_DISABLED )
			{
				SetAppState( VMPI_SERVICE_STATE_IDLE );
			}
			SaveStateToRegistry();
		}
		break;

		case VMPI_SERVICE_UPDATE_PASSWORD:
		{
			const char *pStr = pData + 1;
			SetPassword( pStr );
			
			// Send out the new state.
			SendCurStateTo( -1 );
		}
		break;

		case VMPI_SERVICE_SCREENSAVER_MODE:
		{
			g_bScreensaverMode = (pData[1] != 0);
			SendCurStateTo( -1 );
			SaveStateToRegistry();
		}
		break;

		case VMPI_SERVICE_EXIT:
		{
			Msg( "Got a VMPI_SERVICE_EXIT packet.\n ");
			ServiceHelpers_ExitEarly();
		}
		break;
	}
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:54,代码来源:vmpi_service.cpp

示例7: MessageBox

void CServerDlg::OnBnClickedStart()
{
	CString strPort;
	m_Port.GetWindowText(strPort);
	USHORT usPort = (USHORT)_ttoi(strPort);

	if(usPort == 0)
	{
		MessageBox(_T("Listen Port invalid, pls check!"), _T("Params Error"), MB_OK);
		m_Port.SetFocus();
		return;
	}

	EnSendPolicy enSendPolicy = (EnSendPolicy)m_SendPolicy.GetCurSel();

	CString strThreadCount;
	m_ThreadCount.GetWindowText(strThreadCount);
	int iThreadCount = _ttoi(strThreadCount);

	if(iThreadCount == 0)
		iThreadCount = min((::SysGetNumberOfProcessors() * 2 + 2), 500);
	else if(iThreadCount < 0 || iThreadCount > 500)
	{
		m_ThreadCount.SetFocus();
		return;
	}

	SetAppState(ST_STARTING);

	Reset();

	m_Server->SetSendPolicy(enSendPolicy);
	m_Server->SetWorkerThreadCount(iThreadCount);

	//m_Server->SetFreeSocketObjPool(500);
	//m_Server->SetFreeSocketObjHold(1500);
	//m_Server->SetFreeBufferObjPool(2000);
	//m_Server->SetFreeBufferObjHold(6000);
	//m_Server->SetSocketListenQueue(2000);
	//m_Server->SetAcceptSocketCount(2000);


	if(m_Server->Start(DEFAULT_ADDRESS, usPort))
	{
		::LogServerStart(DEFAULT_ADDRESS, usPort);
		SetAppState(ST_STARTED);
	}
	else
	{
		::LogServerStartFail(m_Server->GetLastError(), m_Server->GetLastErrorDesc());
		SetAppState(ST_STOPPED);
	}
}
开发者ID:32719913,项目名称:HP-Socket,代码行数:53,代码来源:ServerDlg.cpp

示例8: SetAppState

void CServerDlg::OnBnClickedStop()
{
	SetAppState(ST_STOPPING);

	if(::HP_Server_Stop(m_spThis->m_pServer))
	{
		::LogServerStop();
		SetAppState(ST_STOPPED);
	}
	else
	{
		ASSERT(FALSE);
	}
}
开发者ID:32719913,项目名称:HP-Socket,代码行数:14,代码来源:ServerDlg.cpp

示例9: SetAppState

void CClientDlg::OnBnClickedStop()
{
	SetAppState(ST_STOPPING);
	::LogClientStopping(m_pClient->GetConnectionID());

	m_pClient->Stop();

	while(m_pClient->GetState() != SS_STOPPED)
		::Sleep(50);

	if(!m_bListener) ::PostOnClose(m_pClient->GetConnectionID());

	SetAppState(ST_STOPPED);
}
开发者ID:MarkYangUp,项目名称:HP-Socket,代码行数:14,代码来源:ClientDlg.cpp

示例10: SetAppState

void CServerDlg::OnBnClickedStop()
{
	SetAppState(ST_STOPPING);

	if(m_Server->Stop())
	{
		::LogServerStop();
		SetAppState(ST_STOPPED);
	}
	else
	{
		ASSERT(FALSE);
	}
}
开发者ID:32719913,项目名称:HP-Socket,代码行数:14,代码来源:ServerDlg.cpp

示例11: SetIcon

BOOL CClientDlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon

	// TODO: Add extra initialization here

	m_TestTimes.SetCurSel(5);
	m_TestInterv.SetCurSel(1);
	m_ThreadCount.SetCurSel(5);
	m_ThreadInterv.SetCurSel(0);
	m_DataLen.SetCurSel(5);
	m_Address.SetWindowText(DEFAULT_ADDRESS);
	m_Port.SetWindowText(DEFAULT_PORT);

	::SetMainWnd(this);
	::SetInfoList(&m_Info);
	SetAppState(ST_STOPED);

	return TRUE;  // return TRUE  unless you set the focus to a control
}
开发者ID:JeffLi1993,项目名称:HP-Socket,代码行数:25,代码来源:ClientDlg.cpp

示例12: SetIcon

BOOL CClientDlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon

	// TODO: Add extra initialization here

	m_Method.SetCurSel(3);
	m_Schema.SetCurSel(0);

	m_Path.SetWindowText(DEFAULT_PATH);
	m_Address.SetWindowText(DEFAULT_ADDRESS);
	m_Port.SetWindowText(DEFAULT_PORT);
	m_UseCookie.SetCheck(BST_CHECKED);
	m_Listener.SetCheck(BST_CHECKED);

	::SetMainWnd(this);
	::SetInfoList(&m_Info);
	SetAppState(ST_STOPPED);

	m_bUseCookie = FALSE;
	m_bListener	 = FALSE;
	m_bWebSocket = FALSE;

	return TRUE;  // return TRUE  unless you set the focus to a control
}
开发者ID:MarkYangUp,项目名称:HP-Socket,代码行数:30,代码来源:ClientDlg.cpp

示例13: if

BOOL CClientDlg::CheckStarted(BOOL bRestart)
{
	if(m_pClient == nullptr)
		return FALSE;

	EnServiceState state = m_pClient->GetState();

	if(state == SS_STARTED)
		return TRUE;
	else if(state == SS_STARTING)
	{
		do 
		{
			::Sleep(50);
			state = m_pClient->GetState();
		} while(state != SS_STARTED && state != SS_STOPPED);
	}
	else
	{
		SetAppState(bRestart ? ST_STARTING : ST_STOPPING);

		while(state != SS_STOPPED)
		{
			::Sleep(50);
			state = m_pClient->GetState();
		}

		if(bRestart)
		{
			if(!m_bListener) ::LogOnClose(m_pClient->GetConnectionID());

			OnBnClickedStart();
		}

		state = m_pClient->GetState();
	}

	if(state == SS_STOPPED)
	{
		if(!m_bListener) ::PostOnClose(m_pClient->GetConnectionID());

		SetAppState(ST_STOPPED);
		return FALSE;
	}

	return TRUE;
}
开发者ID:MarkYangUp,项目名称:HP-Socket,代码行数:47,代码来源:ClientDlg.cpp

示例14: SetAppState

EnHandleResult CClientDlg::OnClose(IClient* pClient, EnSocketOperation enOperation, int iErrorCode)
{
	iErrorCode == SE_OK ? ::PostOnClose(pClient->GetConnectionID())		:
	::PostOnError(pClient->GetConnectionID(), enOperation, iErrorCode)	;

	SetAppState(ST_STOPPED);

	return HR_OK;
}
开发者ID:32719913,项目名称:HP-Socket,代码行数:9,代码来源:ClientDlg.cpp

示例15: SetAppState

void CClientDlg::OnBnClickedStop()
{
	SetAppState(ST_STOPPING);

	if(::HP_Client_Stop(m_pClient))
		::LogClientStopping(::HP_Client_GetConnectionID(m_pClient));
	else
		ASSERT(FALSE);
}
开发者ID:32719913,项目名称:HP-Socket,代码行数:9,代码来源:ClientDlg.cpp


注:本文中的SetAppState函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。