Esempio n. 1
0
int32 NetManager::Connect( char* sAddr, int32 nPort, bool bSingleThread)
{
	NetChannelBase* pBase = CreateNewChannel();
	if(!pBase)
		return -1;

	int32 nChannelID = -1;
	pBase->InitChannel( this, m_nSockRcBufSize, m_nRcBufSize, m_nSockRnBufSize, m_nSnBufSize);

	if(pBase->Connect( sAddr, nPort))
	{
		if(bSingleThread)
		{
			AddNewConnection( pBase, false, false);
			ProcNewConnection();
		}
		else
		{
			AddNewConnection( pBase, false, true);
		}

		nChannelID = pBase->GetID();
	}

	FreeChannel( pBase );

	return nChannelID;
}
Esempio n. 2
0
void ConnectionGraph::OnNewConnection(SystemAddress systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
{
	if (isIncoming==false)
	{
		if (autoAddNewConnections==false)
			return;

		RequestConnectionGraph(systemAddress);

		// 0 is the default groupId
		AddNewConnection(rakPeerInterface, systemAddress, rakNetGUID, 0);
	}
	else
	{
		if (autoAddNewConnections==false)
			return;

		// 0 is the default groupId
		AddNewConnection(rakPeerInterface, systemAddress, rakNetGUID, 0);
	}
}