Esempio n. 1
0
        /// <summary>
        /// Ends a pending asynchronous read.
        /// </summary>
        /// <param name="asyncResult">
        /// An
        /// <see cref="System.IAsyncResult">IAsyncResult</see>
        /// that stores state information for this asynchronous operation.
        /// </param>
        /// <returns>The number of bytes read.</returns>
        ///
        /// <exception cref="System.ObjectDisposedException">
        /// The <see cref="BytesRoad.Net.Sockets.NetworkStreamEx"/> object was disposed.
        /// </exception>
        ///
        /// <exception cref="System.ArgumentNullException">
        /// <i>asyncResult</i> is a null reference
        /// (<b>Nothing</b> in Visual Basic).
        /// </exception>
        /// <exception cref="System.ArgumentException">
        /// <i>asyncResult</i> was not returned by a call to the
        /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx.BeginRead"/>
        /// method.
        /// </exception>
        /// <exception cref="System.InvalidOperationException">
        /// <b>EndRead</b> was previously called for the
        /// asynchronous read.
        /// </exception>
        ///
        /// <exception cref="System.Net.Sockets.SocketException">
        /// An error occurred when attempting to access
        /// the socket which is used to complete the requested operation.
        /// </exception>
        ///
        /// <remarks>
        /// <b>EndRead</b> is a blocking method that completes the
        /// asynchronous read operation started in the
        /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx.BeginRead"/> method.
        ///
        /// <para>
        /// The read operation will not completed until the number of bytes specified by <i>size</i>
        /// parameter (to <b>BeginRead</b> method) is read from the stream. If the remote host shuts down the
        /// <see cref="BytesRoad.Net.Sockets.SocketEx"/>
        /// connection with the
        /// <see cref="BytesRoad.Net.Sockets.SocketEx.Shutdown"/>
        /// method, and all available data has been received, the <b>Read</b> method
        /// will complete and return number of bytes was read.
        /// </para>
        ///
        /// <note>
        /// The <b>NetworkStreamEx</b> should have access right to read data from the network stream.
        /// You may use <see cref="BytesRoad.Net.Sockets.NetworkStreamEx.CanRead"/> property to check this.
        /// </note>
        ///
        /// </remarks>
        public override int EndRead(IAsyncResult asyncResult)
        {
            AsyncBase.VerifyAsyncResult(asyncResult, typeof(Read_SO), "EndRead");
            _asyncCtx.HandleAsyncEnd(asyncResult, true);
            Read_SO stateObj = (Read_SO)asyncResult;

            return(stateObj.Read);
        }
Esempio n. 2
0
        internal FtpDataConnection EndExecute(IAsyncResult ar)
        {
            AsyncBase.VerifyAsyncResult(ar, typeof(GetDC_SO));
            HandleAsyncEnd(ar, true);
            GetDC_SO stateObj = (GetDC_SO)ar;

            return(stateObj.DC);
        }
        public override int EndRead(IAsyncResult asyncResult)
        {
            AsyncBase.VerifyAsyncResult(asyncResult, typeof(Read_SO), "EndRead");
            this._asyncCtx.HandleAsyncEnd(asyncResult, true);
            Read_SO d_so = (Read_SO)asyncResult;

            return(d_so.Read);
        }
Esempio n. 4
0
        internal FtpItem[] EndExecute(IAsyncResult ar)
        {
            AsyncBase.VerifyAsyncResult(ar, typeof(List_SO));
            HandleAsyncEnd(ar, true);

            FtpItem[] ret = new FtpItem[_items.Count];
            _items.CopyTo(ret);
            return(ret);
        }
Esempio n. 5
0
 internal void EndExecute(IAsyncResult ar)
 {
     AsyncBase.VerifyAsyncResult(ar, typeof(Reset_SO));
     HandleAsyncEnd(ar, false);
 }
 private void EndSubNegotiation_UsernamePassword(IAsyncResult ar)
 {
     AsyncBase.VerifyAsyncResult(ar, typeof(UsernamePassword_SO));
     this.HandleAsyncEnd(ar, true);
 }
 private void EndReadWhole(IAsyncResult ar)
 {
     AsyncBase.VerifyAsyncResult(ar, typeof(ReadWhole_SO));
     this.HandleAsyncEnd(ar, false);
 }
 private byte[] EndReadVerifyReply(IAsyncResult ar)
 {
     AsyncBase.VerifyAsyncResult(ar, typeof(ReadVerifyReply_SO));
     this.HandleAsyncEnd(ar, false);
     return(((ReadVerifyReply_SO)ar).Reply);
 }
 private void EndNegotiate(IAsyncResult ar)
 {
     AsyncBase.VerifyAsyncResult(ar, typeof(Negotiation_SO));
     this.HandleAsyncEnd(ar, false);
 }
 private void EndDoAuthentication(IAsyncResult ar)
 {
     AsyncBase.VerifyAsyncResult(ar, typeof(DoAuthentication_SO));
     this.HandleAsyncEnd(ar, false);
 }
 internal override void EndBind(IAsyncResult asyncResult)
 {
     AsyncBase.VerifyAsyncResult(asyncResult, typeof(Bind_SO), "EndBind");
     this.HandleAsyncEnd(asyncResult, true);
 }
 internal override SocketBase EndAccept(IAsyncResult asyncResult)
 {
     AsyncBase.VerifyAsyncResult(asyncResult, typeof(Accept_SO), "EndAccept");
     this.HandleAsyncEnd(asyncResult, true);
     return(this);
 }
Esempio n. 13
0
 internal void EndExecute(IAsyncResult ar)
 {
     AsyncBase.VerifyAsyncResult(ar, typeof(PutFile_SO));
     HandleAsyncEnd(ar, true);
 }
Esempio n. 14
0
 internal override int EndReceive(IAsyncResult asyncResult)
 {
     AsyncBase.VerifyAsyncResult(asyncResult, typeof(Receive_SO), "EndReceive");
     this.HandleAsyncEnd(asyncResult, false);
     return(((Receive_SO)asyncResult).Read);
 }
 internal override void EndConnect(IAsyncResult asyncResult)
 {
     AsyncBase.VerifyAsyncResult(asyncResult, typeof(Connect_SO), "EndConnect");
     this.HandleAsyncEnd(asyncResult, true);
 }
 public override void EndWrite(IAsyncResult asyncResult)
 {
     AsyncBase.VerifyAsyncResult(asyncResult, typeof(Write_SO), "EndWrite");
     this._asyncCtx.HandleAsyncEnd(asyncResult, true);
 }
Esempio n. 17
0
 internal string EndExecute(IAsyncResult ar)
 {
     AsyncBase.VerifyAsyncResult(ar, typeof(PutFileUnique_SO));
     HandleAsyncEnd(ar, true);
     return(_uniqueFileName);
 }