pub async fn connect_with_port(
        hostname: &str,
        port: u32,
        user: &str,
        password: &str,
    ) -> Result<Self, crate::error::Error> {
        let host = format!("{}:{}", hostname, port);
        let addr = host.to_socket_addrs()?.next().unwrap();
        let raw_stream = TcpStream::connect(&addr).await?;
        let stream = BufReader::new(raw_stream);

        let buffer = String::new();
        let mut client = Client {
            stream,
            buffer,
            welcome_string: None,
            mode: ClientMode::ExtendedPassive,
        };
        let response = client
            .parse_reply_expecting(vec![StatusCodeKind::ReadyForNewUser])
            .await?;
        client.welcome_string = Some(response.message);
        client.login(user, password).await?;

        Ok(client)
    }
/// Connect to a new FTP server using plain text (no TLS) on a specific port.
Connect to a new FTP server using plain text (no TLS) on a specific port.
Connect to a new FTP server using plain text ( no TLS ) on a specific port .
pub async fn connect_with_port(
        hostname: &str,
        port: u32,
        user: &str,
        password: &str,
    ) -> Result<Self, crate::error::Error> {
        let host = format!("{}:{}", hostname, port);
        let addr = host.to_socket_addrs()?.next().unwrap();
        let raw_stream = TcpStream::connect(&addr).await?;
        let stream = BufReader::new(raw_stream);
        let buffer = String::new();
        let mut client = Client {
            stream,
            buffer,
            welcome_string: None,
            mode: ClientMode::ExtendedPassive,
        };
        let response = client
            .parse_reply_expecting(vec![StatusCodeKind::ReadyForNewUser])
            .await?;
        client.welcome_string = Some(response.message);
        client.login(user, password).await?;
        Ok(client)
    }
pub async fn connect_with_port ( hostname : & str , port : u32 , user : & str , password : & str , ) -> Result < Self , crate :: error :: Error > { let host = format ! ( " " hostname port ) ; let addr = host . to_socket_addrs ( ) ? . next ( ) . unwrap ( ) ; let raw_stream = TcpStream :: connect ( & addr ) . await ? ; let stream = BufReader :: new ( raw_stream ) ; let buffer = String :: new ( ) ; let mut client = Client { stream , buffer , welcome_string : None , mode : ClientMode :: ExtendedPassive , } ; let response = client . parse_reply_expecting ( vec ! [ StatusCodeKind ReadyForNewUser ] ) . await ? ; client . welcome_string = Some ( response . message ) ; client . login ( user , password ) . await ? ; Ok ( client ) }
Connect to a new FTP server using plain text (no TLS) on a specific port.
Connect to a new FTP server using plain text ( no TLS ) on a specific port .
hostname
&str
port
u32
user
&str
password
&str
hostname
&str
port
u32
user
&str
password
&str