Beispiel #1
0
        public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback?callback, object?state)
        {
            ReadAsyncResult result = new ReadAsyncResult(this, callback, state);

            result.Read(buffer, offset, count);
            return(result);
        }
Beispiel #2
0
        public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback?callback, object?state)
        {
            ValidateBufferArguments(buffer, offset, count);

            var result = new ReadAsyncResult(this, buffer, offset, count, callback, state);

            result.Read();
            return(result);
        }
 public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
 {
     if (buffer == null)
     {
         throw new ArgumentNullException("buffer");
     }
     if ((offset < 0) || (offset > buffer.Length))
     {
         throw new ArgumentOutOfRangeException("offset");
     }
     if ((offset + count) > buffer.Length)
     {
         throw new ArgumentOutOfRangeException("count");
     }
     ReadAsyncResult result = new ReadAsyncResult(this, buffer, offset, count, callback, state);
     result.Read();
     return result;
 }
Beispiel #4
0
        public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
        {
            if (buffer == null)
            {
                throw new ArgumentNullException("buffer");
            }
            if ((offset < 0) || (offset > buffer.Length))
            {
                throw new ArgumentOutOfRangeException("offset");
            }
            if ((offset + count) > buffer.Length)
            {
                throw new ArgumentOutOfRangeException("count");
            }
            ReadAsyncResult result = new ReadAsyncResult(this, buffer, offset, count, callback, state);

            result.Read();
            return(result);
        }
Beispiel #5
0
        public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
        {
            if (buffer == null)
            {
                throw new ArgumentNullException(nameof(buffer));
            }
            if (offset < 0 || offset > buffer.Length)
            {
                throw new ArgumentOutOfRangeException(nameof(offset));
            }
            if (offset + count > buffer.Length)
            {
                throw new ArgumentOutOfRangeException(nameof(count));
            }

            var result = new ReadAsyncResult(this, buffer, offset, count, callback, state);

            result.Read();
            return(result);
        }
Beispiel #6
0
 private static void OnRead(IAsyncResult result)
 {
     if (!result.CompletedSynchronously)
     {
         ReadAsyncResult thisPtr = (ReadAsyncResult)result.AsyncState;
         try
         {
             if (!thisPtr.CompleteRead(result))
             {
                 thisPtr.Read();
             }
         }
         catch (Exception e)
         {
             if (thisPtr.IsCompleted)
             {
                 throw;
             }
             thisPtr.InvokeCallback(e);
         }
     }
 }
Beispiel #7
0
 public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
 {
     ReadAsyncResult result = new ReadAsyncResult(this, callback, state);
     result.Read(buffer, offset, count);
     return result;
 }
Beispiel #8
0
        public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
        {
            if (buffer == null)
            {
                throw new ArgumentNullException(nameof(buffer));
            }
            if (offset < 0 || offset > buffer.Length)
            {
                throw new ArgumentOutOfRangeException(nameof(offset));
            }
            if (offset + count > buffer.Length)
            {
                throw new ArgumentOutOfRangeException(nameof(count));
            }

            var result = new ReadAsyncResult(this, buffer, offset, count, callback, state);
            result.Read();
            return result;
        }