Ejemplo n.º 1
0
        void SendCommandEx_End(IAsyncResult ar)
        {
            RunDTP_SO stateObj = (RunDTP_SO)ar.AsyncState;

            try
            {
                stateObj.UpdateContext();
                FtpResponse response = _cc.EndSendCommandEx(ar);
                if (response.IsCompletionReply)
                {
                    NSTrace.WriteLineWarning("Executing DTP: receive completion as first reply.");
                    UnlockCC(stateObj);
                    stateObj.SetCompleted();
                }
                else
                {
                    FtpClient.CheckPreliminaryResponse(response);

                    //establish connection now, if it is inbound
                    if (FtpDataConnectionType.Inbound == _currentDC.Type)
                    {
                        _currentDC.BeginEstablish(stateObj.Timeout,
                                                  new AsyncCallback(this.InboundEstablish_End),
                                                  stateObj);
                    }
                    else
                    {
                        DoRunDTP(stateObj);
                    }
                }
            }
            catch (Exception e)
            {
                HandleCatch(e, stateObj);
            }
            catch
            {
                HandleCatch(null, stateObj);
            }
        }