Exemplo n.º 1
0
        public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback?callback, object?state)
        {
            ValidateBufferArguments(buffer, offset, count);

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

            result.Write();
            return(result);
        }
Exemplo n.º 2
0
 private static void OnWrite(IAsyncResult result)
 {
     if (!result.CompletedSynchronously)
     {
         WriteAsyncResult thisPtr = (WriteAsyncResult)result.AsyncState;
         try
         {
             thisPtr.CompleteWrite(result);
             thisPtr.Write();
         }
         catch (Exception e)
         {
             thisPtr.InvokeCallback(e);
         }
     }
 }
 public override IAsyncResult BeginWrite(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");
     }
     WriteAsyncResult result = new WriteAsyncResult(this, buffer, offset, count, callback, state);
     result.Write();
     return result;
 }
        public override IAsyncResult BeginWrite(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");
            }
            WriteAsyncResult result = new WriteAsyncResult(this, buffer, offset, count, callback, state);

            result.Write();
            return(result);
        }
Exemplo n.º 5
0
        public override IAsyncResult BeginWrite(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 WriteAsyncResult(this, buffer, offset, count, callback, state);

            result.Write();
            return(result);
        }
Exemplo n.º 6
0
        public override IAsyncResult BeginWrite(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 WriteAsyncResult(this, buffer, offset, count, callback, state);
            result.Write();
            return result;
        }