Ejemplo n.º 1
0
static void spCopyAllCon(
	ZRef<ZStreamerRCon> iStreamerRCon, ZRef<ZStreamerWCon> iStreamerWCon, size_t iChunkSize)
	{
	while (ZStream::sCopyAllCon(
		iStreamerRCon->GetStreamRCon(), iChunkSize, iStreamerWCon->GetStreamWCon(), 10))
		{}
	}
Ejemplo n.º 2
0
static void spCopyChunked(ZRef<ZStreamerRCon> iStreamerRCon, ZRef<ZStreamerWCon> iStreamerWCon)
	{
	const ZStreamRCon& r = iStreamerRCon->GetStreamRCon();
	const ZStreamWCon& w = iStreamerWCon->GetStreamWCon();
	try
		{
		while (true)
			{
			const size_t theSize = r.ReadUInt16LE();

			if (theSize == 0)
				{
				// End of stream
				r.ReceiveDisconnect(-1);
				w.SendDisconnect();
				break;
				}
			else
				{
				std::vector<char> buffer(theSize);

				r.Read(&buffer[0], theSize);
				w.Write(&buffer[0], theSize);
				}
			}
		}
	catch (...)
		{
		r.Abort();
		w.Abort();
		}
	}