示例#1
0
 public void ReadMultilineTest()
 {
     var ftpReply = new FtpReply();
     Assert.IsTrue(ftpReply.ParseLine("220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------"));
     Assert.IsTrue(ftpReply.ParseLine("220-You are user number 1 of 1000 allowed."));
     Assert.IsTrue(ftpReply.ParseLine("220-Local time is now 01:29. Server port: 21."));
     Assert.IsTrue(ftpReply.ParseLine("220-This is a private system - No anonymous login"));
     Assert.IsTrue(ftpReply.ParseLine("220-IPv6 connections are also welcome on this server."));
     Assert.IsFalse(ftpReply.ParseLine("220 You will be disconnected after 15 minutes of inactivity."));
 }
示例#2
0
        public void ReadMultilineTest()
        {
            var ftpReply = new FtpReply();

            Assert.IsTrue(ftpReply.ParseLine("220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------"));
            Assert.IsTrue(ftpReply.ParseLine("220-You are user number 1 of 1000 allowed."));
            Assert.IsTrue(ftpReply.ParseLine("220-Local time is now 01:29. Server port: 21."));
            Assert.IsTrue(ftpReply.ParseLine("220-This is a private system - No anonymous login"));
            Assert.IsTrue(ftpReply.ParseLine("220-IPv6 connections are also welcome on this server."));
            Assert.IsFalse(ftpReply.ParseLine("220 You will be disconnected after 15 minutes of inactivity."));
        }
示例#3
0
        /// <summary>
        ///		Lee la respuesta de un stream
        /// </summary>
        internal FtpReply ReadReply()
        {
            FtpReply reply = new FtpReply();
            bool     end   = false;

            // Lee las líneas recibidas
            while (!end)
            {
                string line = ReadLine();

                // Si no ha recibido nada, se desconecta
                if (line == null)
                {
                    Connection.Disconnect();
                    throw new Exceptions.FtpTransportException($"Error cuando se procesaba la respuesta a ({reply})");
                }
                // Si no puede interpretar la línea, sale del bucle
                end = !reply.ParseLine(line);
            }
            // Lanza el evento con la respuesta
            Connection.Client.RaiseEventReply(new EventArguments.ProtocolMessageEventArgs(null, null, reply));
            // Devuelve la respuesta
            return(reply);
        }