Пример #1
0
bool CEXIETHERNET::RecvStart()
{
	if (!IsActivated())
		return false;

	if (mHRecvEvent == INVALID_HANDLE_VALUE)
		RecvInit();

	DWORD res = ReadFile(mHAdapter, mRecvBuffer, BBA_RECV_SIZE,
		(LPDWORD)&mRecvBufferLength, &mReadOverlapped);

	if (res)
	{
		// Since the read is synchronous here, complete immediately
		RecvHandlePacket();
		return true;
	}
	else
	{
		DWORD err = GetLastError();
		if (err == ERROR_IO_PENDING)
		{
			return true;
		}

		// Unexpected error
		ERROR_LOG(SP1, "Failed to recieve packet with error 0x%X", err);
		return false;
	}

}
Пример #2
0
bool CEXIETHERNET::RecvStart()
{
	if (!IsActivated())
		return false;

	if (mHRecvEvent == INVALID_HANDLE_VALUE)
		RecvInit();

	DWORD res = ReadFile(mHAdapter, mRecvBuffer, BBA_RECV_SIZE,
		(LPDWORD)&mRecvBufferLength, &mReadOverlapped);

	if (!res && (GetLastError() != ERROR_IO_PENDING))
	{
		// error occurred
		return false;
	}

	if (res)
	{
		// Completed immediately
		RecvHandlePacket();
	}

	return true;
}