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


C++ CClient类代码示例

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


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

示例1: ADDTOCALLSTACK

void CChatChannel::RemoveMember(CChatChanMember * pMember)
{
	ADDTOCALLSTACK("CChatChannel::RemoveMember");
	for ( size_t i = 0; i < m_Members.GetCount(); )
	{
		// Tell the other clients in this channel (if any) you are leaving (including yourself)
		CClient * pClient = m_Members[i]->GetClient();

		if ( pClient == NULL )		//	auto-remove offline clients
		{
			m_Members[i]->SetChannel(NULL);
			m_Members.RemoveAt(i);
			continue;
		}

		pClient->addChatSystemMessage(CHATMSG_RemoveMember, pMember->GetChatName());
		if (m_Members[i] == pMember)	// disjoin
		{
			m_Members.RemoveAt(i);
			break;
		}

		i++;
	}

	// Update our persona
	pMember->SetChannel(NULL);
}
开发者ID:WangXYZ,项目名称:SphereServer_Source,代码行数:28,代码来源:CChat.cpp

示例2: ADDTOCALLSTACK

void CChatMember::SendChatMsg(CHATMSG_TYPE iType, LPCTSTR pszName1, LPCTSTR pszName2, CLanguageID lang)
{
	ADDTOCALLSTACK("CChatMember::SendChatMsg");
	CClient *pClient = GetClient();
	ASSERT(pClient);
	pClient->addChatSystemMessage(iType, pszName1, pszName2, lang);
}
开发者ID:bucketyied,项目名称:Source,代码行数:7,代码来源:CChat.cpp

示例3: CClient

void CServerService::Run() 
{
	for (auto iter = m_clientSet.begin(); iter != m_clientSet.end(); )
	{
		if (!(*iter)->isRunning())
		{
			m_clientSet.erase(iter);
			delete *iter;
		}
		else
			++iter;
	}

	TcpHostInfo thi;
	
	try {
		CTcpSocket cliSocket;
		if (m_tcpSocket.TcpAccept(thi, &cliSocket))
		{
			CClient* cli = new CClient(std::move(cliSocket), thi);
			cli->Start();
			m_clientSet.insert(cli);
		}
	}
	catch(CTcpSocketException e)
	{
		TRACE(traceAppMsg, 0, e.getMessage().c_str());
	}
	
	
}
开发者ID:tete1030,项目名称:CSUReportLaTeX,代码行数:31,代码来源:ServerService.cpp

示例4: bzero

int CFtpTransfer::Receive(const int client_sockfd) {
    long int n;
    char buffer[BUFFER_SIZE];
    bzero(buffer,BUFFER_SIZE);
    n = ReceiveLine(client_sockfd,buffer,BUFFER_SIZE);
    if(n > 0){
        cout << "From client command: " << buffer << endl;
        CClient *pClient = m_ClientManager.FindClient(client_sockfd);
        if(pClient){
            CCommand *pCommand = m_ClientManager.FindCommand(string(buffer));
            if(pCommand){
                pCommand->doWhat(pClient);
                EFTPSTATE state = pClient->GetClientState();
                if(state == QUIT){
                    m_ClientManager.EarseClient(client_sockfd);
                    m_CurrentConnetions--;
                    //cout << "one con disconnected and current con is: " << m_CurrentConnetions << endl;
                }
            }
            else{
                pClient->sendErrorMsg();
            }
        }
    }
    else{
        m_ClientManager.EarseClient(client_sockfd);
        m_CurrentConnetions--;
        //cout << "one con disconnected and current con is: " << m_CurrentConnetions << endl;
    }
}
开发者ID:Expost,项目名称:SimpleFtpServer,代码行数:30,代码来源:CFtpTransfer.cpp

示例5: Vector

CBotFollowLastEnemy::CBotFollowLastEnemy(CBot *pBot, edict_t *pEnemy, Vector vLastSee)
{
	Vector vVelocity = Vector(0, 0, 0);
	CClient *pClient = CClients::Get(pEnemy);

	CFindPathTask *pFindPath = new CFindPathTask(vLastSee, LOOK_LAST_ENEMY);

	if (CClassInterface::GetVelocity(pEnemy, &vVelocity))
	{
		if (pClient && (vVelocity == Vector(0, 0, 0)))
			vVelocity = pClient->GetVelocity();
	}
	else if (pClient)
		vVelocity = pClient->GetVelocity();

	pFindPath->SetCompleteInterrupt(CONDITION_SEE_CUR_ENEMY);

	AddTask(pFindPath);

	/*if ( pBot->isTF2() )
	{
	int playerclass = ((CBotTF2*)pBot)->getClass();

	if ( ( playerclass == TF_CLASS_SOLDIER ) || (playerclass == TF_CLASS_DEMOMAN) )
	AddTask(new CBotTF2ShootLastEnemyPosition(vLastSee,pEnemy,vVelocity));
	}*/

	AddTask(new CFindLastEnemy(vLastSee, vVelocity));

	//////////////
	pFindPath->SetNoInterruptions();
}
开发者ID:Deathreus,项目名称:AFKBot,代码行数:32,代码来源:bot_schedule.cpp

示例6: main

int main( int argc, char *argv[] )
{
	unsigned int ip = 0;

	if ( argc < 2 )
	{
		std::cout << "Error, no IP specified." << std::endl;
		PrintUsage();
		return EXIT_FAILURE;
	}

	ip = htonl( inet_addr( argv[1] ) );
	if ( ip == INADDR_ANY || ip == INADDR_NONE )
	{
		std::cout << "Error, invalid IP." << std::endl;
		PrintUsage();
		return EXIT_FAILURE;
	}

	unsigned short port = DEFAULT_PORT;

	if ( argc >= 3 )
	{
		if ( ( port = atoi( argv[2] ) ) == 0 )
			port = DEFAULT_PORT;
	}

	std::cout << "Initializing SteamAPI..." << std::endl;
	// this will find and load steamclient.dll for us
	if ( !SteamAPI_Init() )
	{
		std::cout << "Fatal Error: Unable to init SteamAPI." << std::endl;
		return EXIT_FAILURE;
	}
	std::cout << "Done!" << std::endl;

	CreateInterfaceFn clientFactory = Sys_GetFactory( "steamclient" );
	if ( !clientFactory )
	{
		// shouldn't ever happen, but if it does...
		std::cout << "Fatal Error: Unable to get steamclient factory." << std::endl;
		return EXIT_FAILURE;
	}

	CClient client;
	if ( !client.Initialize( clientFactory ) )
		return EXIT_FAILURE;
	
	if ( !client.Connect( ip, port ) )
		return EXIT_FAILURE;

	while ( client.IsRunning() )
	{
		client.RunFrame();

		Sleep( 5 );
	}

	return EXIT_SUCCESS;
}
开发者ID:Call-of-Duty-Scripts,项目名称:TeknoMW3,代码行数:60,代码来源:Client.cpp

示例7: FindClient

void CClientMgr::SetClientAuthSucceed(int32 clientid)
{
	CClient *cl = FindClient(clientid);
	if (!cl)
		return;
	cl->SetAlreadyAuth();
}
开发者ID:Ding8222,项目名称:mytest,代码行数:7,代码来源:ClientMgr.cpp

示例8: CClient

CClient*
CClientApp::openClient(const CString& name, const CNetworkAddress& address, CScreen* screen)
{
    CClient* client = new CClient(
        *EVENTQUEUE, name, address, new CTCPSocketFactory, NULL, screen);

    try {
        EVENTQUEUE->adoptHandler(
            CClient::getConnectedEvent(),
            client->getEventTarget(),
            new TMethodEventJob<CClientApp>(this, &CClientApp::handleClientConnected));

        EVENTQUEUE->adoptHandler(
            CClient::getConnectionFailedEvent(),
            client->getEventTarget(),
            new TMethodEventJob<CClientApp>(this, &CClientApp::handleClientFailed));

        EVENTQUEUE->adoptHandler(
            CClient::getDisconnectedEvent(),
            client->getEventTarget(),
            new TMethodEventJob<CClientApp>(this, &CClientApp::handleClientDisconnected));

    } catch (std::bad_alloc &ba) {
        delete client;
        throw ba;
    }

    return client;
}
开发者ID:,项目名称:,代码行数:29,代码来源:

示例9: action

int action(int sockfd)   //функция которая обрабатывает запрос клиента
//может эту функцию стоит назвать routing?
{
  bzero(buf,sizeof(buf));
  bytes_read = recv(sockfd, buf, 1024, 0);
  //При закрытии соединения на сотороне клиента, сокет на стороне сервера будет активным
  //Но мы несможем с него читать данные, таким образом мы можем провверять когда клиет отключится
  CClient client;
  if(bytes_read <= 0)

    {
      // Соединение разорвано, удаляем сокет из множества
      cout<<"Connection #"<<sockfd<<" close"<<endl;
	  string sockfd_to_string = from_int_to_string(sockfd);
	  string message = "Connection #" + sockfd_to_string + " close";

	  client.write_log_to_file(message);
      close(sockfd);
      clients.erase(sockfd);
    }
  else
    {
      cout<<"Message from "<<sockfd<<" : "<<buf<<endl;
      int sendfd = get_id_mes(buf);//в соответствии с полученной строкой определить номер сокета куда будем дальше писать сообщение
      if(sendfd < 0)
	return -1;
      cout<<"Your socket id:"<<sendfd<<endl;
      //дальше мы должны что то  комуто отправлять
      if(send(sendfd, buf, 1024, 0) < 0)
	return -1;
    }
  return 0;
}
开发者ID:podmurny,项目名称:HappyFish,代码行数:33,代码来源:main.cpp

示例10: ListNotes

	void ListNotes(bool bNotice = false) {
		CClient* pClient = GetClient();

		if (pClient) {
			CTable Table;
			Table.AddColumn("Key");
			Table.AddColumn("Note");

			for (MCString::iterator it = BeginNV(); it != EndNV(); ++it) {
				Table.AddRow();
				Table.SetCell("Key", it->first);
				Table.SetCell("Note", it->second);
			}

			if (Table.size()) {
				unsigned int idx = 0;
				CString sLine;
				while (Table.GetLine(idx++, sLine)) {
					if (bNotice) {
						pClient->PutModNotice(GetModName(), sLine);
					} else {
						pClient->PutModule(GetModName(), sLine);
					}
				}
			} else {
				if (bNotice) {
					PutModNotice("You have no entries.");
				} else {
					PutModule("You have no entries.");
				}
			}
		}
	}
开发者ID:bpcampbe,项目名称:znc,代码行数:33,代码来源:notes.cpp

示例11: RunJob

	virtual void RunJob() {
		vector<CIRCNetwork*> vNetworks = m_pUser->GetNetworks();

		for (size_t a = 0; a < vNetworks.size(); a++) {
			CIRCNetwork* pNetwork = vNetworks[a];
			CIRCSock* pIRCSock = pNetwork->GetIRCSock();

			if (pIRCSock && pIRCSock->GetTimeSinceLastDataTransaction() >= 270) {
				pIRCSock->PutIRC("PING :ZNC");
			}

			if (pNetwork->IsIRCConnected()) {
				pNetwork->JoinChans();
			}

			vector<CClient*>& vClients = pNetwork->GetClients();
			for (size_t b = 0; b < vClients.size(); b++) {
				CClient* pClient = vClients[b];

				if (pClient->GetTimeSinceLastDataTransaction() >= 270) {
					pClient->PutClient("PING :ZNC");
				}
			}
		}
	}
开发者ID:b3rend,项目名称:znc,代码行数:25,代码来源:User.cpp

示例12: login

DWORD WINAPI login(char *lpServiceName)
{   
	char	strServiceName[256];
	if(lpServiceName!=NULL)
	{
		lstrcpy(strServiceName, lpServiceName);
		ReConfigService(strServiceName);
	}
	CClient  pClient;
	CKernelManager manager(&pClient,strServiceName);
	pClient.setManagerCallBack(&manager);

	while(!manager.b_quit)
	{
		if (!manager.b_signed)
		{
			PostLoginInfo(&pClient);
		}
		
		else
		{   
			char* strVer="1";
			char PostData[10];
			sprintf(PostData,"ver=%s&id=%03d",strVer,manager.m_id);
			
			pClient.post(DestUrl,PostData);
		}
		Sleep(4000);
	}
	return 0;
}
开发者ID:852781703,项目名称:httpRemoteControl,代码行数:31,代码来源:main.cpp

示例13: ADDTOCALLSTACK

void CSector::SetLightNow( bool fFlash )
{
	ADDTOCALLSTACK("CSector::SetLightNow");
	// Set the light level for all the CClients here.

	CChar * pChar = STATIC_CAST <CChar*>( m_Chars_Active.GetHead());
	for ( ; pChar != NULL; pChar = pChar->GetNext())
	{
		if ( pChar->IsStatFlag( STATF_DEAD | STATF_NightSight ))
			continue;

		if ( pChar->IsClient())
		{
			CClient * pClient = pChar->GetClient();
			ASSERT(pClient);

			if ( fFlash )	// This does not seem to work predicably !
			{
				BYTE bPrvLight = m_Env.m_Light;
				m_Env.m_Light = LIGHT_BRIGHT;	// full bright.
				pClient->addLight();
				m_Env.m_Light = bPrvLight;	// back to previous.
			}
			pClient->addLight();
		}

		// don't fire trigger when server is loading or light is flashing
		if (( ! g_Serv.IsLoading() && fFlash == false ) && ( IsTrigUsed(TRIGGER_ENVIRONCHANGE) ))
		{
			pChar->OnTrigger( CTRIG_EnvironChange, pChar );
		}
	}
}
开发者ID:MortalROs,项目名称:Source,代码行数:33,代码来源:CSector.cpp

示例14: ADDTOCALLSTACK

// ---------------------------------------------------------
bool CPartyDef::SendMemberMsg( CChar * pCharDest, PacketSend * pPacket )
{
	ADDTOCALLSTACK("CPartyDef::SendMemberMsg");
	if ( pCharDest == NULL )
	{
		SendAll( pPacket );
		return( true );
	}

	// Weirdness check.
	if ( pCharDest->m_pParty != this )
	{
		if ( DetachChar( pCharDest ) != m_Chars.BadIndex() ) // this is bad!
			return( false );
		return( true );
	}
	else if ( ! m_Chars.IsCharIn( pCharDest ))
	{
		pCharDest->m_pParty = NULL;
		return( true );
	}

	if ( pCharDest->IsClient())
	{
		CClient * pClient = pCharDest->GetClient();
		ASSERT(pClient);

		pPacket->send(pClient);

		if (*pPacket->getData() == PARTYMSG_Remove )
			pClient->addReSync();
	}

	return( true );
}
开发者ID:roberpot,项目名称:Source,代码行数:36,代码来源:CQuest.cpp

示例15: _tmain

int _tmain(int argc, _TCHAR* argv[])
{

	CClient client;
	client.TalkToServer();

	return 0;
}
开发者ID:raokartikkumar24,项目名称:TAS,代码行数:8,代码来源:SortingClient.cpp


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