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


C++ UdpSocket::socket方法代码示例

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


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

示例1: HashMapShrPtr

ServiceManager::~ServiceManager()
{
	uint32 maxTcpNum = m_tcpSktClrNum*m_perClrTcpSktNum;
	for (uint32 i=0; (i<maxTcpNum && m_usingTcp); ++i)
	{
		TcpSocket* tcpSkt = (TcpSocket*)sTcpSktFList.get()->get(i);
		if (tcpSkt)
		{
			tcpSkt->close();
			tcpSkt->clean();
		}
	}

	HashMapShrPtr hm = sSSLSktFList.getFls();
	if (hm)
	{
		uint32 size = hm->arraySize();
		for (uint32 i=0; i<size; ++i)
		{
			hm->lockWrite((ContextId)i, (ContextId)i);
			std::map<ContextId, IFreeListShrPtr>& hmMap = hm->map(i);
			for (std::map<ContextId, IFreeListShrPtr>::iterator itr=hmMap.begin(); itr!=hmMap.end(); ++itr)
			{
				uint32 maxSSLSktNum = itr->second->getClr() * itr->second->getPer();
				for (uint32 j=0; (j<maxSSLSktNum && m_usingSSL); ++j)
				{
					SSLSocket* sslSkt = (SSLSocket*)itr->second->get(j);
					if (sslSkt)
					{
						sslSkt->socket()->lowest_layer().close();
						sslSkt->clean();
					}
				}
			}
			hm->unlockWrite((ContextId)i, (ContextId)i);
		}
	}
	hm = HashMapShrPtr();

	uint32 maxUdpSubNum = m_udpSubSktClrNum*m_perClrUdpSubSktNum;
	for (uint32 i=0; (i<maxUdpSubNum && m_usingUdp); ++i)
	{
		UdpSubSocket* udpSubSkt = (UdpSubSocket*)sUdpSubSktFList.get()->get(i);
		if (udpSubSkt)
		{
			udpSubSkt->close();
			udpSubSkt->clean();
		}
	}
	uint32 maxUdpNum = m_udpSktClrNum*m_perClrUdpSktNum;
	for (uint32 i=0; (i<maxUdpNum && m_usingUdp); ++i)
	{
		UdpSocket* udpSkt = (UdpSocket*)sUdpSktFList.get()->get(i);
		if (udpSkt)
		{
			udpSkt->socket()->close();
			udpSkt->clean();
		}
	}

	m_contexts.clear();

	for (uint32 i=0; i<m_tcpAcptrSvcs.size(); ++i)
	{
		if (m_tcpAcptrSvcs[i])
			delete m_tcpAcptrSvcs[i];
	}
	for (uint32 i=0; i<m_sslAcptrSvcs.size(); ++i)
	{
		if (m_sslAcptrSvcs[i])
			delete m_sslAcptrSvcs[i];
	}
	for (uint32 i=0; i<m_udpAcptrSvcs.size(); ++i)
	{
		if (m_udpAcptrSvcs[i])
			delete m_udpAcptrSvcs[i];
	}
	for (uint32 i=0; i<m_tcpSvcs.size(); ++i)
	{
		if (m_tcpSvcs[i])
			delete m_tcpSvcs[i];
	}
	for (uint32 i=0; i<m_sslSvcs.size(); ++i)
	{
		if (m_sslSvcs[i])
			delete m_sslSvcs[i];
	}
	for (uint32 i=0; i<m_udpSvcs.size(); ++i)
	{
		if (m_udpSvcs[i])
			delete m_udpSvcs[i];
	}
	
}
开发者ID:utah2013zyd,项目名称:Game,代码行数:94,代码来源:ServiceManager.cpp


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