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


C++ TBreakPacket::UnlinkPart方法代码示例

本文整理汇总了C++中TBreakPacket::UnlinkPart方法的典型用法代码示例。如果您正苦于以下问题:C++ TBreakPacket::UnlinkPart方法的具体用法?C++ TBreakPacket::UnlinkPart怎么用?C++ TBreakPacket::UnlinkPart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TBreakPacket的用法示例。


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

示例1: sizeof

//--------------------------------------------------------------
void TScLoginClient_MasterImpl::SendResultAccept2ClientAndSlave(unsigned int key, 
                                                                void* resForClient, 
                                                                int sizeResClient)
{
  // Client
  TBreakPacket bp;
  bp.PushFront((char*)resForClient, sizeResClient);
  THeaderResultLoginM2C hForClient;
  hForClient.id_client     = key;
  hForClient.result        = THeaderResultLoginM2C::eAccept;
  hForClient.sizeResClient = sizeResClient;
  bp.PushFront((char*)&hForClient, sizeof(hForClient));
  Context()->GetMS()->Send(GetID_SessionClientMaster(), bp);
  bp.UnlinkPart();// очистить от частей
  // Slave
  THeaderInfoClientM2S hForSlave;
  hForSlave.id_client = key;
  bp.PushFront((char*)&hForSlave, sizeof(hForSlave));
  Context()->GetMS()->Send(GetID_SessionMasterSlave(), bp);

  // ждем ответ от Slave
  SetWaitSlave();
}
开发者ID:2asoft,项目名称:MMO-Framework,代码行数:24,代码来源:ScLoginClient_MasterImpl.cpp

示例2: main

//-------------------------------------------------------------------
int main(int argc, char** argv)
{
#if 0
  // внутри MMOEngine
  nsMMOEngine::TEventTryLogin erfd;
  erfd.id_session = 1;
  erfd.sizeData   = 100;
  TContainer* pC  = new TContainer;
  pC->SetData(NULL, sizeof(nsMMOEngine::TEventTryLogin) + erfd.sizeData);
  memcpy(pC->GetPtr(), &erfd, sizeof(nsMMOEngine::TEventTryLogin));
  // внутри DeveloperDLL
  nsMMOEngine::TBaseEvent* pBE = (nsMMOEngine::TBaseEvent*)pC->GetPtr();
  switch(pBE->mType)
  {
    case nsMMOEngine::TBase::eTryLogin:
    {
      nsMMOEngine::TEventTryLogin* pERFD = (nsMMOEngine::TEventTryLogin*)pBE;
      break;
    }
    default:;
  }
  delete pC;
#endif
    g_ShareTest->Init("Client");

	TArgData d;
	GetByArg(argc,argv,d);
	printf("port=%u,TimeSleep=%d,cnt=%d\n",d.port_client, d.time_sleep, d.cnt);

  INetTransport* pNetTransport = g_ShareTest->GetTransport();

  bool res = pNetTransport->Open(d.port_client);
  g_ShareTest->Register();

	pNetTransport->Start();

  TBreakPacket packetForSend;
	if(pNetTransport->Connect(d.ip, TShareTest::ePortServer))
	{
		unsigned int start = ht_GetMSCount();
		for(int i = 0 ; i < TShareTest::eCntRecvPacket ;)
		{
			for(int j = 0 ; j < d.cnt ; j++ )
			{
        packetForSend.UnlinkPart();
        packetForSend.PushFront(g_ShareTest->GetPacket(), TShareTest::eSizePacket);
        pNetTransport->Send(d.ip, TShareTest::ePortServer, packetForSend, true);
				i++;
				if(i==TShareTest::eCntRecvPacket)
					break;
			}
			ht_msleep(d.time_sleep);
      if(g_ShareTest->IsDisconnect())
        break;
		}
		start = ht_GetMSCount() - start;
    printf("time=%d ms, v=%f \n",
      start,float(TShareTest::eSizePacket*TShareTest::eCntRecvPacket)/(start*1000));
	}
  pNetTransport->Close(d.ip,TShareTest::ePortServer);
	pNetTransport->Stop();
  BL_ASSERT(pNetTransport->IsActive()==false);
  g_ShareTest->Unregister();

  //_getch();
  return 0;
}
开发者ID:norak,项目名称:MMO-Framework,代码行数:68,代码来源:mainClient.cpp


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