public IAsyncResult BeginSendFile( string fileName, byte[] preBuffer, byte[] postBuffer, TransmitFileOptions flags, AsyncCallback callback, object state) { // Start the context flowing. No lock necessary. TransmitFileOverlappedAsyncResult asyncResult = new TransmitFileOverlappedAsyncResult(this,state,callback); asyncResult.StartPostingAsyncOp(false); // Start the operation. DoBeginSendFile(fileName, preBuffer, postBuffer, flags, asyncResult); // Finish the op, collect the context or maybe call the callback. asyncResult.FinishPostingAsyncOp(ref Caches.SendClosureCache); return asyncResult; }
public IAsyncResult BeginSendFile(string fileName, byte[] preBuffer, byte[] postBuffer, TransmitFileOptions flags, AsyncCallback callback, object state) { TransmitFileOverlappedAsyncResult asyncResult = new TransmitFileOverlappedAsyncResult(this, state, callback); asyncResult.StartPostingAsyncOp(false); this.DoBeginSendFile(fileName, preBuffer, postBuffer, flags, asyncResult); asyncResult.FinishPostingAsyncOp(ref this.Caches.SendClosureCache); return (IAsyncResult) asyncResult; }