Esempio n. 1
0
 internal FtpSessionConnected(FtpClient h, FtpControlChannel ctrl, bool caseInsensitive)
 {
     m_host = h;
     m_ctrlChannel = ctrl;
     m_ctrlChannel.Session = this;
     m_caseInsensitive = caseInsensitive;
 }
Esempio n. 2
0
 internal FtpDataStream(FtpControlChannel ctrl, TcpClient client)
 {
     m_session = ctrl.Session;
     m_ctrl = ctrl;
     m_tcpClient = client;
     m_stream = client.GetStream();
     m_session.BeginDataTransfer(this);
 }
Esempio n. 3
0
 internal FtpOutputDataStream(FtpControlChannel ctrl, TcpClient client)
     : base(ctrl, client)
 {
 }
Esempio n. 4
0
        public void Connect(string userName, string password)
        {
            FtpControlChannel ctrl = new FtpControlChannel(m_host);

            ctrl.Server = m_server;
            ctrl.Port = m_port;
            ctrl.Connect();

            try
            {
                ctrl.Command("USER " + userName);

                if (ctrl.LastResponse.Code == FtpResponse.UserAcceptedWaitingPass)
                    ctrl.Command("PASS " + password);

                if (ctrl.LastResponse.Code != FtpResponse.UserLoggedIn)
                    throw new FtpAuthenticationException("Failed to login.", ctrl.LastResponse);

                m_host.State = new FtpSessionConnected(m_host, ctrl, m_caseInsensitive);
                ((FtpSessionConnected)m_host.State).InitRootDirectory();
            }
            catch
            {
                ctrl.Close();
                throw;
            }
        }