RemObjects.InternetPack.Connection.BeginRead C# (CSharp) Method

BeginRead() public method

public BeginRead ( Byte buffer, Int32 offset, Int32 count, AsyncCallback callback, Object state ) : IAsyncResult
buffer Byte
offset System.Int32
count System.Int32
callback AsyncCallback
state Object
return IAsyncResult
		public override IAsyncResult BeginRead(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback callback, Object state)
		{
			if (!this.BufferedAsync)
				return IntBeginRead(buffer, offset, count, callback, state);

			AsyncRequest lRequest = new AsyncRequest();
			lRequest.AsyncBuffer = buffer;
			lRequest.AsyncOffset = offset;
			lRequest.AsyncCount = count;
			lRequest.AsyncRest = count;
			lRequest.AsyncCallback = callback;
			lRequest.AsyncState = state;

			try
			{
				if (fBuffer != null && fBufferEnd - fBufferStart > 0)
				{
					IAsyncResult lAr = new BufferAsyncResult(buffer, offset, count, lRequest);
					IntReadCallback(lAr);

					return lAr;
				}

				IntBeginRead(buffer, offset, count, IntReadCallback, lRequest);
			}
			catch (ObjectDisposedException) // disconnect from this side
			{
				TriggerAsyncDisconnect();
				throw;
			}
			catch (SocketException) // disconnect
			{
				TriggerAsyncDisconnect();
				throw;
			}

			return lRequest;
		}