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


C++ CIOBuffer类代码示例

本文整理汇总了C++中CIOBuffer的典型用法代码示例。如果您正苦于以下问题:C++ CIOBuffer类的具体用法?C++ CIOBuffer怎么用?C++ CIOBuffer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: lock

CIOBuffer *CIOBuffer::Allocator::Allocate()
{
    CCriticalSection::Owner lock( m_criticalSection );

    CIOBuffer *pBuffer = 0;

    if ( !m_freeList.Empty() )
    {
        pBuffer = m_freeList.PopNode();

        pBuffer->AddRef();
    }
    else
    {
        pBuffer = new( m_bufferSize )CIOBuffer( *this, m_bufferSize );

        if ( !pBuffer )
        {
            throw CException( _T("CIOBuffer::Allocator::Allocate()"), _T("Out of memory") );
        }

        OnBufferCreated();
    }

    m_activeList.PushNode( pBuffer );

    OnBufferAllocated();

    return pBuffer;
}
开发者ID:ueverything,项目名称:mmo-resourse-1,代码行数:30,代码来源:IOBuffer.cpp

示例2: Error

HRESULT CServer::OnDataRecieved()
{
   if (!m_pSocketServer)
   {
      return Error(L"Server hasn't been initialised - programming error!");
   }

   if (!m_pIDataInit || !m_pIData)
   {
      return Error(L"Internal error: failed to create Data object");
   }
   
   CCOMSocketServer::Socket *pSocket = m_pSocketServer->GetSocket();

   CIOBuffer *pBuffer = m_pSocketServer->GetBuffer();

   if (!pSocket || !pBuffer)
   {
      return Error(L"Internal error: pSocket or pBuffer is 0");
   }

   ISocket *pISocket = reinterpret_cast<ISocket*>(pSocket->GetUserPtr());

   HRESULT hr = m_pIDataInit->Init(pBuffer->GetBuffer(), pBuffer->GetUsed());

   if (SUCCEEDED(hr))
   {  
      Fire_OnDataReceived(pISocket, m_pIData);   // this can stall if the handler doesnt return - 
                                                 // the ATL implementation is difficult to multi thread...
   }

   return hr;
}
开发者ID:legacygamedev,项目名称:limited-source,代码行数:33,代码来源:Server.cpp

示例3: getToBuffer

// if user wants result to buffer?
void QXpkLib::getToBuffer(QByteArray &Array)
{
	CIOBuffer *pOut = m_pMaster->getResult();
	
	// reserve out-buffer and copy what we have
	Array.resize(pOut->GetCurrentPos());
	::memcpy(Array.data(), pOut->GetBegin(), pOut->GetCurrentPos());
}
开发者ID:ipr,项目名称:qXpkLib,代码行数:9,代码来源:qxpklib.cpp

示例4: Allocate

void CSocketServer::PostAbortiveClose( Socket *pSocket )
{
	CIOBuffer *pBuffer = Allocate();
	
	pBuffer->SetUserData( IO_Close );
	
	pSocket->AddRef();
	
	m_iocp.PostStatus( (ULONG_PTR)pSocket, 0, pBuffer );
}
开发者ID:XeanoRRR,项目名称:mmo-resourse,代码行数:10,代码来源:SocketServer.cpp

示例5:

// 각각의 메모리 풀에서 하나 가져온다.
//***************************************
CIOBuffer * SCMemoryManager::AllocPerRecvBuffer()
{
	CIOBuffer * pRecvBuffer = NULL;

	pRecvBuffer = m_pRecvBufferMemPool->Alloc();
	pRecvBuffer->m_WSABuf.buf = pRecvBuffer->GetRecvBuffer();
	pRecvBuffer->m_WSABuf.len = MAX_BUFFER_LEN;

	return pRecvBuffer;
}
开发者ID:astromaker,项目名称:sandbox,代码行数:12,代码来源:MemoryManager.cpp

示例6: memmove

CIOBuffer *CIOBuffer::SplitBuffer( size_t bytesToRemove )
{
    CIOBuffer *pNewBuffer = m_allocator.Allocate();

    pNewBuffer->AddData( m_buffer_ptr, bytesToRemove );

    m_used -= bytesToRemove;

    memmove( m_buffer_ptr, m_buffer_ptr + bytesToRemove, m_used );

    return pNewBuffer;
}
开发者ID:ueverything,项目名称:mmo-resourse-1,代码行数:12,代码来源:IOBuffer.cpp

示例7: load_regressor

void CVwRegressor::load_regressor(char* file)
{
	CIOBuffer source;
	int32_t fd = source.open_file(file, 'r');

	if (fd < 0)
		SG_SERROR("Unable to open file for loading regressor!\n")

	// Read version info
	vw_size_t v_length;
	source.read_file((char*)&v_length, sizeof(v_length));
	char* t = SG_MALLOC(char, v_length);
	source.read_file(t,v_length);
	if (strcmp(t,env->vw_version) != 0)
	{
		SG_FREE(t);
		SG_SERROR("Regressor source has an incompatible VW version!\n")
	}
开发者ID:behollis,项目名称:muViewBranch,代码行数:18,代码来源:VwRegressor.cpp

示例8: Allocate

void CSocketClient::Write( const char *pData, size_t dataLength )
{
	if ( INVALID_SOCKET != m_connectSocket &&
		dataLength > 0 &&
		pData )
	{
		CIOBuffer *pBuffer = Allocate();
		
		/*
		 * Call to unqualified virtual function
		 */
		PreWrite( pBuffer, pData, dataLength );

		pBuffer->AddData( pData, dataLength );

		/*
		 * Begin to send data
		 */
		pBuffer->SetupWrite();
		
		DWORD dwFlags = 0;
		DWORD dwSendNumBytes = 0;
		
		if ( SOCKET_ERROR == ::WSASend(
					m_connectSocket,
					pBuffer->GetWSABUF(), 
					1, 
					&dwSendNumBytes,
					dwFlags,
					pBuffer, 
					NULL) )
		{
			DWORD lastError = ::WSAGetLastError();
			
			if ( ERROR_IO_PENDING != lastError )
			{
				Output( _T("CSocketClient::Write() - WSASend: ") + GetLastErrorMessage( lastError ) );
				
				if ( lastError == WSAECONNABORTED || 
					lastError == WSAECONNRESET ||
					lastError == WSAEDISCON)
				{
					StopConnections();
				}
			}
		}
		
		if ( pBuffer->GetUsed() != pBuffer->GetWSABUF()->len )
		{
			/*
			 * Call to unqualified virtual function
			 */
			//OnError(_T("CSocketClient::WriteCompleted - Socket write where not all data was written"));
		}

		pBuffer->Release();
	}
}
开发者ID:XeanoRRR,项目名称:mmo-resourse,代码行数:58,代码来源:SocketClient.cpp

示例9: ReadChunks

//////////////////
//
// XPK fileformat:
// chunk-based, crunched data in chunks
//
// Chunk format:
// * chunk header
// - 1 byte for chunk type
// - 1 byte for chunk header checksum ?
// - 2 bytes for chunk checksum
// - 2/4 bytes for chunk (compressed) length
// - 2/4 bytes for uncompressed length?
// * chunk data
// - amount of packed data given in chunk header..
//
// Note: chunk header may have different size in different file
// according to flags (if "long" sizes are used for chunks).
//
//
void XpkTags::ReadChunks(CIOBuffer &Buffer)
{
	m_pFirst = new XpkChunk();
	m_pFirst->m_nDataOffset = Buffer.GetCurrentPos();

	XpkChunk *pCurrent = m_pFirst;
	while (Buffer.IsEnd() == false)
	{
		bool isValidHeader = false;
		if (m_streamHeader.xsh_Flags & XPKSTREAMF_LONGHEADERS)
		{
			XpkChunkHdrLong *pHdr = (XpkChunkHdrLong*)Buffer.GetAtCurrent();
			
			pCurrent->m_Type = pHdr->xchl_Type;
			pCurrent->m_HChecksum = pHdr->xchl_HChk;
			pCurrent->m_ChunkChecksum = Swap2(pHdr->xchl_CChk);
			pCurrent->m_ChunkLength = Swap4(pHdr->xchl_CLen);
			pCurrent->m_UnLen = Swap4(pHdr->xchl_ULen);
			
			pCurrent->m_nDataOffset += sizeof(XpkChunkHdrLong);
			isValidHeader = verifyHeaderLong(pHdr);
		}
		else
		{
			XpkChunkHdrWord *pHdr = (XpkChunkHdrWord*)Buffer.GetAtCurrent();
			
			pCurrent->m_Type = pHdr->xchw_Type;
			pCurrent->m_HChecksum = pHdr->xchw_HChk;
			pCurrent->m_ChunkChecksum = Swap2(pHdr->xchw_CChk);
			pCurrent->m_ChunkLength = Swap2(pHdr->xchw_CLen);
			pCurrent->m_UnLen = Swap2(pHdr->xchw_ULen);

			pCurrent->m_nDataOffset += sizeof(XpkChunkHdrWord);
			isValidHeader = verifyHeaderWord(pHdr);
		}
		
		// TODO: need header checksum verification somewhere around here..
		if (isValidHeader == false)
		{
			// TODO: exception or skip ?
		}
		
		if (pCurrent->m_Type != XPKCHUNK_RAW
			&& pCurrent->m_Type != XPKCHUNK_PACKED
			&& pCurrent->m_Type != XPKCHUNK_END)
		{
			// TODO: exception or skip ?
		}
		
		// move to actual data of chunk (according to chunk header size)
		Buffer.SetCurrentPos(pCurrent->m_nDataOffset);

		// "end-of-file" chunk? (empty)
		if (pCurrent->m_Type == XPKCHUNK_END)
		{
			return;
		}
		
		// TODO:
		// .. process chunk
		// -> walkthrough in XPK-master now..
		
		// offset to start of next chunk:
		// start of data in current + size of data in current
		size_t nNextChunkOffset = pCurrent->m_nDataOffset + pCurrent->m_ChunkLength;
		Buffer.SetCurrentPos(nNextChunkOffset);
		
		pCurrent->m_pNext = new XpkChunk(pCurrent);
		pCurrent->m_pNext->m_nDataOffset = nNextChunkOffset;
		pCurrent = pCurrent->m_pNext;
	}
}
开发者ID:ipr,项目名称:qXpkLib,代码行数:91,代码来源:XpkTags.cpp

示例10: ReadStreamHeader

//////////////////
//
// XPK fileformat:
// chunk-based, crunched data in chunks
// 
// File header:
// starts as common IFF-style header:
// - 4-byte ID, 'XPKF'
// - 4-byte int for filesize minus header (8)
// - 4-byte sub-type (cruncher-ID) e.g. 'SQSH'
// - 4-byte int for total uncompressed length ?
// - first 16-bytes of original file
// - 1 byte for flags
// - 1 byte for header checksum ?
// - 1 byte for minor version of cruncher/library ?
//  - actually version required of sub-library..
// - 1 byte for major version of cruncher/library ?
//
bool XpkTags::ReadStreamHeader(CIOBuffer &Buffer)
{
	// should have enough data to actually parse file header
	if (Buffer.GetSize() < sizeof(XpkStreamHeader))
	{
		return false;
	}
	
	if (isXpkFile(Buffer.GetBegin()) == false)
	{
		return false;
	}
	Buffer.SetCurrentPos(0); // start at beginning if not already..
	
	// set default
	m_formatType = XPKMODE_UPSTD;
	
	// "XPKF", 0x58504b46 (XPK_COOKIE, magic number)
	// note: support also XFD-packed files? ("XFDD")
	m_streamHeader.xsh_PackID = GetULong(Buffer.GetNext(4));
	
	if (m_streamHeader.xsh_PackID != MakeTag("XPKF"))
	// this too ? && m_streamHeader.xsh_PackID != MakeTag("XFDD"))
	{
		return false;
	}
	
	// file length without IFF header (type+length = 8) ?
	m_streamHeader.xsh_CompressedLen = GetULong(Buffer.GetNext(4));
	
	// keep packer type as type name/ID,
	// just access as-is
	m_typeName.assign((char*)Buffer.GetAtCurrent(), 4);
	
	// packer type, e.g. "SQSH", "NUKE", "RLEN"..
	m_streamHeader.xsh_PackerType = GetULong(Buffer.GetNext(4));
	
	// TODO: check supported types..? if != MakeTag()..
	// -> caller/parent should do (knows libraries..)
	
	// uncompressed length?
	m_streamHeader.xsh_UnpackedLen = GetULong(Buffer.GetNext(4));

	// first 16 bytes of original file
	::memcpy(m_streamHeader.xsh_Initial, Buffer.GetNext(16), 16);
	
	// flags
	m_streamHeader.xsh_Flags = Buffer.GetNextByte();
	
	/*
	// also check "XFDD", 0x58464444 in file ID?
	if (m_streamHeader.xsh_Flags & XMF_XFD && m_streamHeader.xsh_PackID == MakeTag("XFDD"))
	{
		m_formatType = XPKMODE_UPXFD;
	}
	
	if (m_streamHeader.xsh_Flags & XMF_PASSTHRU)
	{
		// unpacked?
		m_formatType = XPKMODE_UPUP;
	}
	
	if (m_streamHeader.xsh_Flags & XPKSTREAMF_PASSWORD)
	{
		// password-protected file?
	}
	*/
	
	// ..no idea.. header checksum?
	m_streamHeader.xsh_HeaderChk = Buffer.GetNextByte();
	
	// minor&major version of XPK master/cruncher?
	m_streamHeader.xsh_SubVrs = Buffer.GetNextByte(); // sub-library version required?
	m_streamHeader.xsh_MasVrs = Buffer.GetNextByte();
	
	// TODO: remove later, debug-test..
	if (Buffer.GetCurrentPos() != sizeof(XpkStreamHeader))
	{
		throw IOException("Read size does not match stream-header size");
	}
	
	// non-zero header checksum? (note where doing checksumming..)
//.........这里部分代码省略.........
开发者ID:ipr,项目名称:qXpkLib,代码行数:101,代码来源:XpkTags.cpp

示例11: GetMessageSize

CIOBuffer *CGameClient::ProcessDataStream( OnlineGameLib::Win32::CIOBuffer *pBuffer)
{
	bool done;
	
//	DEBUG_ONLY( Output( _T("ProcessDataStream:\n") + DumpData( pBuffer->GetBuffer(), pBuffer->GetUsed(), 40 ) ) );
	
	do
	{
		done = true;
		
		const size_t used = pBuffer->GetUsed();
		
		if ( used >= GetMinimumMessageSize() )
		{
			const size_t messageSize = GetMessageSize( pBuffer );
			
			if ( messageSize == 0 )
			{
				/*
				 * havent got a complete message yet.
				
				 * we null terminate our messages in the buffer, so we need to reserve
				 * a byte of the buffer for this purpose...
				 */
				
				if ( used == ( pBuffer->GetSize() - 1 ) )
				{
					Output( _T("Too much data!") );
					
					/*
					 * Write this message and then shutdown the sending side of the socket.
					 */
					Output( "found error and close this connection!" );
		
					StopConnections();
					
					/*
					 * throw the rubbish away
					 */
					pBuffer->Empty();
					
					done = true;
				}
			}
			else if ( used == messageSize )
			{
				Output( _T("Got complete, distinct, message") );
				/*
				 * we have a whole, distinct, message
				 */
				
				pBuffer->AddData(0);   // null terminate the command string;
				
				ProcessCommand( pBuffer );
				
				pBuffer->Empty();
				
				done = true;
			}
			else if (used > messageSize)
			{
				Output(_T("Got message plus extra data"));
				/*
				 * we have a message, plus some more data
				 * 
				 * allocate a new buffer, copy the extra data into it and try again...
				 */
				
				CIOBuffer *pMessage = pBuffer->SplitBuffer( messageSize );
				
				pMessage->AddData(0);   // null terminate the command string;
				
				ProcessCommand( pMessage );
				
				pMessage->Release();
				
				/*
				 * loop again, we may have another complete message in there...
				 */
				
				done = false;
			}
		}
	}
	while ( !done );
	
	/*
	 * not enough data in the buffer, reissue a read into the same buffer to collect more data
	 */
	return pBuffer;
}
开发者ID:XeanoRRR,项目名称:mmo-resourse,代码行数:91,代码来源:GameClient.cpp

示例12: XH_GUARD

	void CTcpSocket::on_inter_close(int errid, bool bconnecting)
	{
		if (m_status != status_connect && m_status != status_common) return;

		XH_GUARD([&]{
			closetcpsocket(m_socket);
			m_socket = INVALID_SOCKET;

			if (m_io)
			{
				if ((m_bassign & 0x01) == 0x01)
					m_io->Del_Event(&m_ev_read);
				if ((m_bassign & 0x02) == 0x02)
					m_io->Del_Event(&m_ev_write);

				m_bassign = 0;
				m_io->Del_TcpSocket(this);
			}
		});

		m_status = status_null;

		switch (m_type)
		{
		case type_listener:
			if (m_lcb)
			{
				if (bconnecting)
				{
					m_lcb->On_Listen(GetSocketID(), errid);
				}

				m_lcb->On_Close(GetSocketID(), errid);
			}
			break;
		case type_accepter:
			if (m_acb)
			{
				if (bconnecting)
				{
					m_acb->On_Connect(GetSocketID(), errid);
				}

				while (!m_wait_send.empty())
				{
					CIOBuffer* tmpbuf = m_wait_send.front();
					XH_GUARD([&]{tmpbuf->Release(); });

					m_acb->On_Send(GetSocketID(), errid, tmpbuf);

					m_wait_send.pop();
				}

				while (!m_wait_recv.empty())
				{
					CIOBuffer* tmpbuf = m_wait_recv.front();
					XH_GUARD([&]{tmpbuf->Release(); });

					m_acb->On_Recv(GetSocketID(), errid, tmpbuf);

					m_wait_recv.pop();
				}

				m_acb->On_Close(GetSocketID(), errid);

				// 异常调度行为检查
				while (!m_wait_send.empty())
				{
					CIOBuffer* tmpbuf = m_wait_send.front();
					XH_GUARD([&]{tmpbuf->Release(); });

					m_wait_send.pop();
				}
				while (!m_wait_recv.empty())
				{
					CIOBuffer* tmpbuf = m_wait_recv.front();
					XH_GUARD([&]{tmpbuf->Release(); });

					m_wait_recv.pop();
				}
			}
			break;
		case type_connecter:
			if (m_ccb)
			{
				if (bconnecting)
				{
					m_ccb->On_Connect(GetSocketID(), errid);
				}

				while (!m_wait_send.empty())
				{
					CIOBuffer* tmpbuf = m_wait_send.front();
					XH_GUARD([&]{tmpbuf->Release(); });

					m_ccb->On_Send(GetSocketID(), errid, tmpbuf);

					m_wait_send.pop();
				}

//.........这里部分代码省略.........
开发者ID:mybestcool,项目名称:xhnet,代码行数:101,代码来源:impl_tcpsocket.cpp

示例13: switch

	void CTcpSocket::on_inter_send(short flag)
	{
		if (m_status == status_connect)
		{
			if ((flag&EV_WRITE) == EV_WRITE)
			{
				m_status = status_common;

				switch (m_type)
				{
				case type_accepter:
					if (m_acb)
					{
						m_acb->On_Connect(GetSocketID(), tcp_ok);
					}
					break;
				case type_connecter:
					if (m_ccb)
					{
						m_ccb->On_Connect(GetSocketID(), tcp_ok);
					}
					break;
				default:
					break;
				}
			}
			else
			{
				XH_LOG_ERROR(logname_base, "[id:" << m_id << "] tcpsocket connect timeout");
				on_inter_close(tcp_connectfail_timeout, true);

				return;
			}
		}
		else
		{
			while (!m_wait_send.empty())
			{
				CIOBuffer* buff = m_wait_send.front();

				if ( buff->AvailRead()==0 )
				{
					XH_LOG_ERROR(logname_base, "[id:" << m_id << "] tcpsocket::send close cmd");
					on_inter_close(tcp_close_byreset, false);
					return;
				}

				bool bneedbreak = false;
				int sendlen = ::send(m_socket, buff->GetCurRead(), buff->AvailRead(), 0);

				if ( sendlen>0 )
				{
					buff->SeekRead(sendlen);
				}
				else if (sendlen<0)
				{
					if (isnoblockerr())
					{
						bneedbreak = true;
					}
					else
					{
						XH_LOG_ERROR(logname_base, "[id:" << m_id << "] tcpsocket::send failed send - 1");
						on_inter_close(tcp_sendfail_senderr, false);
						return;
					}
				}
				else
				{
					bneedbreak = true;
				}

				//已经写完了,则回调通知
				if (buff->AvailRead()==0)
				{
					switch (m_type)
					{
					case type_accepter:
						if (m_acb)
						{
							m_acb->On_Send(GetSocketID(), tcp_ok, buff);
						}
						break;
					case type_connecter:
						if (m_ccb)
						{
							m_ccb->On_Send(GetSocketID(), tcp_ok, buff);
						}
						break;
					default:
						break;
					}

					m_wait_send.pop();
					buff->Release();
				}

				if (bneedbreak) break;
			}
		}
//.........这里部分代码省略.........
开发者ID:mybestcool,项目名称:xhnet,代码行数:101,代码来源:impl_tcpsocket.cpp

示例14: on_inter_recv

	void CTcpSocket::on_inter_recv(short flag)
	{
		if (m_wait_recv.empty())
		{
			m_io->Del_Event(&m_ev_read);
			return;
		}

		CIOBuffer* recvbuff = m_wait_recv.front();

		int recvlen = ::recv(m_socket, recvbuff->GetCurWrite(), recvbuff->AvailWrite(), 0);
		if (recvlen == 0)
		{
			XH_LOG_INFO(logname_base, "[id:" << m_id << "] tcpsocket::recv failed, closed by peer");
			on_inter_close(tcp_recvfail_closedbypeer, false);
			return;
		}
		else if (recvlen < 0)
		{
			if (isnoblockerr())
			{
				;
			}
			else
			{
				XH_LOG_WARN(logname_base, "[id:" << m_id << "] tcpsocket::recv failed, recv - 1");
				on_inter_close(tcp_recvfail_recverr, false);
			}
			return;
		}

		bool bneedcb = false;
		recvbuff->SeekWrite(recvlen);
		// 如果是readsome
		if ( recvbuff->GetTag()==1 )
		{
			bneedcb = true;
		}
		// 如果是读固定长度
		else
		{
			// 如果读全了
			if (recvbuff->AvailWrite()==0)
			{
				bneedcb = true;
			}
		}

		if ( !bneedcb )
		{
			return;
		}

		switch (m_type)
		{
		case type_accepter:
			if (m_acb)
			{
				m_acb->On_Recv(GetSocketID(), tcp_ok, recvbuff);
			}
			break;
		case type_connecter:
			if (m_ccb)
			{
				m_ccb->On_Recv(GetSocketID(), tcp_ok, recvbuff);
			}
			break;
		default:
			break;
		}

		m_wait_recv.pop();
		recvbuff->Release();

		// 没有可以接收的缓存,则删除事件
		if (m_wait_recv.empty())
		{
			m_io->Del_Event(&m_ev_read);
		}
	}
开发者ID:mybestcool,项目名称:xhnet,代码行数:80,代码来源:impl_tcpsocket.cpp

示例15: while

int CSocketServer::WorkerThread::Run()
{
	try
	{
		while ( true )
		{
			/*
			 * Continually loop to service io completion packets
			 */
			
			bool closeSocket = false;
			
			DWORD dwIoSize = 0;
			Socket *pSocket = 0;
			CIOBuffer *pBuffer = 0;
			
			try
			{
				m_iocp.GetStatus( (PDWORD_PTR)&pSocket, &dwIoSize, (OVERLAPPED **)&pBuffer );
			}
			catch (const CWin32Exception &e)
			{
				if ( e.GetError() != ERROR_NETNAME_DELETED &&
					e.GetError() != WSA_OPERATION_ABORTED )
				{
					throw;
				}
				
				Output( _T("IOCP error [client connection dropped] - ") +
					GetLastErrorMessage( ::WSAGetLastError() ) );
				
				closeSocket = true;
			}
			
			if ( !pSocket )
			{
				/*
				 * A completion key of 0 is posted to the iocp to request us to shut down...
				 */
				
				break;
			}
			
			/*
			 * Call to unqualified virtual function
			 */
			OnBeginProcessing();
			
			if ( pBuffer )
			{
				const IO_Operation operation = static_cast<IO_Operation>( pBuffer->GetUserData() );
				
				switch ( operation )
				{
				case IO_Read_Request:
					
					Read( pSocket, pBuffer );
					
					break;
					
				case IO_Read_Completed :
					
					if ( 0 != dwIoSize )
					{
						pBuffer->Use( dwIoSize );
						
						//DEBUG_ONLY( Output(_T("RX: ") + ToString(pBuffer) + _T("\n") + DumpData(reinterpret_cast<const BYTE*>( pBuffer->GetWSABUF()->buf), dwIoSize, 40) ) );
						
						/*
						 * Call to unqualified virtual function
						 */
						ReadCompleted( pSocket, pBuffer );
					}
					else
					{
						/*
						 * client connection dropped...
						 */
						
						Output( _T("ReadCompleted - 0 bytes - client connection dropped") );
						
						closeSocket = true;
					}
					
					pSocket->Release();
					pBuffer->Release();
					
					break;
					
				case IO_Write_Request :
					
					Write( pSocket, pBuffer );
					
					if ( dwIoSize != 0 )
					{
						/*
						 * final write, now shutdown send side of connection
						 */
						pSocket->Shutdown( SD_SEND );
					}
//.........这里部分代码省略.........
开发者ID:XeanoRRR,项目名称:mmo-resourse,代码行数:101,代码来源:SocketServer.cpp


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