Example #1
0
bool SFProtobufProtocol::SendRequest(BasePacket* pPacket)
{
	unsigned int uWrittenBytes = 0;
	int iResult = serializeOutgoingPacket(*pPacket, oBuffer, uWrittenBytes);
	if (iResult!= SFProtocol::Success)
	{
		return false;
	}

	unsigned int uSize = oBuffer.GetDataSize();
	SFEngine::GetInstance()->SendInternal(pPacket->GetSerial(), oBuffer.GetBuffer(), uSize);

	oBuffer.Pop(uSize);

	return true;
}
Example #2
0
BOOL SFProtobufProtocol::SendRequest(ISession* pSession, BasePacket* pPacket)
{
	unsigned int uWrittenBytes = 0;
	int iResult = serializeOutgoingPacket(*pPacket, oBuffer, uWrittenBytes);
	if (iResult!= SFProtocol::Success)
	{
		return false;
	}

	unsigned int uSize = oBuffer.GetDataSize();
	pSession->SendInternal(oBuffer.GetBuffer(), uSize);

	oBuffer.Pop(uSize);

	return true;
}
Example #3
0
bool SFProtobufProtocol::Encode(BasePacket* pPacket, char** ppBuffer, int& bufferSize)
{
	unsigned int uWrittenBytes = 0;
	int iResult = serializeOutgoingPacket(*pPacket, oBuffer, uWrittenBytes);
	if (iResult != SFProtocol::Success)
	{
		return false;
	}

	unsigned int uSize = oBuffer.GetDataSize();

	oBuffer.Pop(uSize);

	*ppBuffer = oBuffer.GetBuffer();
	bufferSize = uSize;

	return true;
}