internal FtpDataStream(ControlChannel ctrl, TcpClient client) { m_session = ctrl.Session; m_ctrl = ctrl; m_tcpClient = client; m_stream = client.GetStream(); m_session.BeginDataTransfer(this); }
public override void Connect(string user, string pass) { ControlChannel ctrl = new ControlChannel(m_host); ctrl.Server = m_server; ctrl.Port = m_port; ctrl.Connect(); try { ctrl.FtpCommand("USER " + user); if(ctrl.LastResponse.Code == FtpResponse.UserAcceptedWaitingPass) ctrl.FtpCommand("PASS " + pass); if(ctrl.LastResponse.Code != FtpResponse.UserLoggedIn) throw new FtpException("Failed to login.", ctrl.LastResponse); m_host.State = new SessionConnected(m_host, ctrl); ((SessionConnected)m_host.State).InitRootDirectory(); }catch { ctrl.Close(); throw; } }
internal FtpOutputDataStream(ControlChannel ctrl, TcpClient client) : base(ctrl, client) { }
internal SessionConnected(Session h, ControlChannel ctrl) { m_host = h; m_ctrlChannel = ctrl; m_ctrlChannel.Session = this; }